Author |
Message |
Zethear
|
Posted: Tue Jun 03, 2008 8:05 pm Post subject: Need Help: Multiple Enemies |
|
|
Hi!
I'm trying to make a tank game for my grade 10 computer science class and I've run into problem: I dont know how to make more then one enemy...
I've already made one that follows my tank guy perfectly, but I really dont want to copy and past my code and change all the variables 50 times to make 50 enemies.
It would be great if someone could point me in the right direction! Thanks! |
|
|
|
|
|
Sponsor Sponsor
|
|
|
gitoxa
|
Posted: Tue Jun 03, 2008 8:29 pm Post subject: RE:Need Help: Multiple Enemies |
|
|
Check out the Turing Walkthrough for arrays, and for loops. Both will come in handy when moving your tanks. |
|
|
|
|
|
CodeMonkey2000
|
Posted: Tue Jun 03, 2008 9:07 pm Post subject: RE:Need Help: Multiple Enemies |
|
|
Another thing that will help: types and records. Again look in the Turing Walkthrough. |
|
|
|
|
|
andrew.
|
Posted: Tue Jun 03, 2008 9:47 pm Post subject: RE:Need Help: Multiple Enemies |
|
|
I would use arrays. Each time an enemy comes on to the screen, whatever his x and y values and whatever is stored in an array. To make sure you don't run out of "boxes" in your array, just reuse the variables after the enemy is dead or off the screen. |
|
|
|
|
|
riveryu
|
Posted: Tue Jun 03, 2008 10:44 pm Post subject: RE:Need Help: Multiple Enemies |
|
|
Another suggestion, if didnt know already. Dont use processes for anything in your game, not even music, because you dont need to. Also, I've seen people who had trouble with procedures in large programs, they somehow screw up.
Aside from this, what school are you from? |
|
|
|
|
|
syntax_error
|
Posted: Tue Jun 03, 2008 11:22 pm Post subject: RE:Need Help: Multiple Enemies |
|
|
a simple option, make the tanks into objects |
|
|
|
|
|
Zethear
|
Posted: Wed Jun 04, 2008 7:10 am Post subject: Re: Need Help: Multiple Enemies |
|
|
Thanks!
I've used one procedure so far and I am regretting it. The only problem is that I think it's required to get full marks, but I'll have t double check.
Hopefully those tutorials will help me, but I can't understand arrays to save my life unfortunatly.
I'm at Timmins High and Vocational School. |
|
|
|
|
|
petree08
|
Posted: Wed Jun 04, 2008 7:40 am Post subject: RE:Need Help: Multiple Enemies |
|
|
it's good to use procedures, don't use procesees,
I only use processes for music |
|
|
|
|
|
Sponsor Sponsor
|
|
|
|