Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / eneamy shooting problem

Author
Message
agentblob
23
Years of Service
User Offline
Joined: 28th Feb 2003
Location:
Posted: 22nd Mar 2003 22:23
okay ive got 4 baddies and i want them to shoot at you, im using the shooting code from the tutirol example, ive got one to shoot at me, but to make all 4 of them to shoot the only way i can figure out is to copy the shooting code 4 times and using bulletlife1, for first baddie, bulletlife2 for second etc. can anyone help me do it in a simpler way?
thanks
Kentaree
23
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 22nd Mar 2003 23:16
Yeah, declare an array called bulletLife(4), i.e dim bulletLife(4)
next use a for...next loop starting at 1 and ending at 4
for attack=1 to 4
then put the attack routine you use in the loop and change it so each enemy is a number from 1 to four, so if you'd use object position x(objectNumber) to find the position of the enemy before he shoots, change objectNumber to attack and do this for everything that refers to what enemy is to shoot. Then, at the end, use something like bulletLife(attack)=10 or whatevr, so all the enemies bullet lives will be set to 10.

Whatever I did I didn't do it!

Login to post a reply

Server time is: 2026-06-12 03:35:46
Your offset time is: 2026-06-12 03:35:46