Computer Science Canada Moving Two Balls Simultaneously |
Author: | Pearse [ Thu Oct 29, 2009 12:52 pm ] | ||
Post subject: | Moving Two Balls Simultaneously | ||
What is it you are trying to achieve? A user can control one ball, while another ball is moving in a fixed direction, looping. The point is that you are suppose to avoid the second ball, and reach the other side of the screen. What is the problem you are having? Im able to put the two balls onto the screen, but i cannot move the one that is suppose to move. The one that is moving in the fixed direction is moving properly so far, and i have not added in any collision yet. I want to figure this out first. Describe what you have tried to solve this problem Putting the balls in procedures, and calling them. Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Please specify what version of Turing you are using Turing 4.1.1 |
Author: | Murphman [ Thu Oct 29, 2009 1:33 pm ] |
Post subject: | Re: Moving Two Balls Simultaneously |
I am new to Turing but to save you time and alot of Unnecessary code. You code try breaking it up into for loops. And you probaly know this but to make the one ball that is always moving to not be glicthy you can add in setscreen ("setoffscreenonly") and in the loop add View.Update |
Author: | DemonWasp [ Thu Oct 29, 2009 1:38 pm ] | ||
Post subject: | RE:Moving Two Balls Simultaneously | ||
What you want to do is have a drawBall procedure that draws the ball at a single position (not several times with delays in-between, as you have now). Then:
Then, on each iteration of the outer loop, will move the balls each a slight amount and redraw them. You probably want to give each ball a position and a speed (velocity, to be precise) which you can then base movement speeds off of. |