Computer Science Canada Defend the school (lol) one click at a time |
Author: | element4l [ Tue Oct 16, 2007 4:45 pm ] | ||
Post subject: | Defend the school (lol) one click at a time | ||
Ok. this is my final project for my Turing class. It's very early in development, but I need to get this fixed before moving on. As it is now, you can just hold your mouse button over the guys and they'll die (which would be cheating) They need to click 5 time individually to kill them. So basically, the soldiers run, you "kill" them and they go off screen and come back (supposedly as a different person). I'd also like to know if it would be possible to have more people at the same time on the screen without having to manually create them, like bot3, bot4 etc.
|
Author: | Tony [ Tue Oct 16, 2007 5:36 pm ] |
Post subject: | Re: Defend the school (lol) one click at a time |
element4l @ Tue Oct 16, 2007 4:45 pm wrote: I'd also like to know if it would be possible to have more people at the same time on the screen without having to manually create them, like bot3, bot4 etc.
Absolutely. Whenever you find yourself making foo1, foo2, anything_number - chances are you should be using an Array instead. |
Author: | Martin [ Tue Oct 16, 2007 5:54 pm ] | ||||
Post subject: | RE:Defend the school (lol) one click at a time | ||||
For the clicking, you need to keep track of the state. There are really four different states that the moue can be in: 1. Up. 2. Being held down. 3. Being clicked. 4. Being released from a click. Have something like:
Then, when you click on somewhere, add a check like
|
Author: | element4l [ Tue Oct 16, 2007 6:01 pm ] |
Post subject: | RE:Defend the school (lol) one click at a time |
You are both Gods. Thank you |