Computer Science Canada Aiming on Tanks Game |
Author: | theschaef [ Sat Apr 22, 2006 1:50 pm ] | ||
Post subject: | Aiming on Tanks Game | ||
Hey, I'm trying to make a "tanks" game and cannot get the aiming to work properly. Take a look at the code and see what you think i can do.. it doesnt shoot correctly forward and doesnt shoot at all when i make it go backwards.
|
Author: | Cervantes [ Sat Apr 22, 2006 2:38 pm ] |
Post subject: | |
Welcome to CompSci.ca. Format your code properly! It makes helping you a lot easier. It also makes it easier for you, the programmer. Commenting is good too. |
Author: | theschaef [ Sat Apr 22, 2006 3:44 pm ] | ||
Post subject: | |||
The main problem comes in when i have to use "round" for the x and y velocities of the projectile (ie. "projy += round (vely)"). I know that there is a way to do this because ive seen programs where it works, i just dont know how!
|
Author: | HellblazerX [ Sat Apr 22, 2006 8:18 pm ] | ||
Post subject: | |||
First of all, when the user presses the arrow keys, why have the x values changed when you can just change the angle? So, to draw your aimer with the angle:
secondly, create a second "angle" variable, this time for the projectile, because after shooting, you can still control the projectile. |