Computer Science Canada Loops cancel out Mouse.Where - See inside for explanation |
Author: | Flawedspirit [ Thu Jan 15, 2009 1:03 pm ] | ||
Post subject: | Loops cancel out Mouse.Where - See inside for explanation | ||
Okay, so, for a project I am working on, I'm making a game that involves red and blue balls bouncing about a play area being deflected by the player's ball, that follows the mouse. On opposite corners are red and blue goals. Obviously, the red and blue balls go in their respective goals to increase your score. But I digress. What I need is for the playing field to draw and update itself, yet still have the player's ball appear and update: Here is the code, see for yourself:
|
Author: | The_Bean [ Thu Jan 15, 2009 1:23 pm ] |
Post subject: | Re: Loops cancel out Mouse.Where - See inside for explanation |
Follow the path the computer will take through your code (hint: how do you get out of a loop) |
Author: | CodeMonkey2000 [ Thu Jan 15, 2009 8:05 pm ] |
Post subject: | RE:Loops cancel out Mouse.Where - See inside for explanation |
To be more blunt: you never leave drawObjects. You are stuck in an infinite loop, and so movePlayer never gets executed. Try getting rid of the loops within the procedures and call the procedures inside a main loop. |