Shooting problems
Author |
Message |
ssr
|
|
|
|
|
Sponsor Sponsor
|
|
|
Neo
|
Posted: Fri Jan 07, 2005 11:01 pm Post subject: (No subject) |
|
|
Take your shooting procedure out of that for loop and use the main loop instead. Also you should do something about those delays. If you structure your code correctly you should really only need 1 at the end.
|
|
|
|
|
|
Cervantes
|
Posted: Sat Jan 08, 2005 10:39 am Post subject: (No subject) |
|
|
Neo is right: so long as you use a for loop inside your main loop like that, you can't move the plane at the same time as the missle is moving.
When Neo says:
Neo wrote:
Take your shooting procedure out of that for loop and use the main loop instead.
He means to eliminate the for loop that we're talking about and put the missle movement code directly into the main loop, so that it can run simotaneously with your plane movement. How to do that is a little bit tricky, however. What you'l probably want to do is store information about your missle in terms of: x, y, and x_velocity. Then, in your main loop, add x_velocity (you can just call it vx) to the x position of the missle. And then draw the missle at (x,y).
Now there's another problem, though. Since everything is working simotaneously, you can probably just hold down 'y' and fire a bunch of missles at once. Well, you can either make it so that a new missle is only created if 'y' is pressed and if the old missle has reached the end of the screen. Or, you could make a Flexible Array to store a bunch of information about several different missles. This will be tricky, mid you. If you don't know Arrays yet, I suggest you learn them before flexible arrays. records would also be useful to know.
Best of luck!
-Cervantes
|
|
|
|
|
|
ssr
|
Posted: Tue Feb 01, 2005 6:19 pm Post subject: (No subject) |
|
|
Thanks, that helped me alot
|
|
|
|
|
|
|
|