I decided to mess around with my RTS movement world again... And here is what I came up with.

It works 100% for me.

Please leave a comment on how accurate it is for you. :)

The main change is that if you preset your window size it should work
[ATTACH]7100[/ATTACH]

Thanks,

RavenOfCode

x2495iiii

04-27-2015 05:18 AM

Yeah, I remember making a similar movement style that was based on a certain window size.

I went with 800x600.

Good job!

MrMoke

04-27-2015 10:57 AM

Challenge

OK ROC- That's OK, but---

I challenge you to make the following changes to you logic, so that the Play window can be modified to any full-pane sizes, and still work accurately.

1) Use the Rendering preferences to modify the play width and height to a different standard size.

2) Modify the code to prompt your user to click somewhere that will allow you to compute the value of any variables that you may need. Use any fixed variables that you may need only in this portion of your code.

3) Use those newly created variables along with the distance from top/left to control the ball movement.

Only took me a few minutes after I got my head wrapped around it.

RavenOfCode

04-27-2015 05:17 PM

[QUOTE=MrMoke;56100]OK ROC- That's OK, but---

I challenge you to make the following changes to you logic, so that the Play window can be modified to any full-pane sizes, and still work accurately.

1) Use the Rendering preferences to modify the play width and height to a different standard size.

2) Modify the code to prompt your user to click somewhere that will allow you to compute the value of any variables that you may need. Use any fixed variables that you may need only in this portion of your code.

3) Use those newly created variables along with the distance from top/left to control the ball movement.

Only took me a few minutes after I got my head wrapped around it.[/QUOTE]

Im confused... Isnt this what im doing?

1. I set the render size.

2. I do this in the first part of the moveTo method.

3. I do this in the seconds part of the moveTo method...

MrMoke

04-27-2015 05:26 PM

OK- Assume that it's working properly.

Now go back into Rendering, change the size of the window, restart your program and see if it still works without coding changes.

Mine does.;)

x2495iiii

04-28-2015 04:36 AM

I remember doing this too! A bunch of us did, actually.

We called it calibration...because that's kinda what it was :P

RavenOfCode

04-28-2015 05:43 AM

[QUOTE=MrMoke;56104]OK- Assume that it's working properly.

Now go back into Rendering, change the size of the window, restart your program and see if it still works without coding changes.

Mine does.;)[/QUOTE]

hmm... ill think up something... since I have a large test coming up I most likely wont sit down and do it till Thursday...

MrMoke

04-28-2015 10:35 AM

A large test - oh boy!!!
I hope it's standardized!
I love large standardized tests.