Hi, I'm (attempting) making a vertical scrolling shmup and getting bullets to workd properly is sending me crazy. At the moment it looks like this
set display mode 1280, 800, 32
sync rate 60
hide mouse
sync on
global n as integer
global shots as integer = 1
global shotDelay as integer =5
global moveSpeed as integer = 2
make object cube 1000, 10
position object 1000, 0,0,0
make camera 1
position camera 1, 0,0, -200
do
text 0,10, "x:"+str$(object position x(1000))
text 0,20, "y:"+str$(object position y(1000))
text 0, 30, "shots: " +str$(shots)
if upkey()=1 and object position y(1000)<110 then move object up 1000, movespeed
if downkey()=1 and object position y(1000)>-110 then move object down 1000, movespeed
if leftkey()=1 and object position x(1000) >-180 then move object left 1000, movespeed
if rightkey()=1 and object position x(1000) <180 then move object right 1000, movespeed
if shiftkey()=1 then movespeed = 4
if shiftkey()=0 then movespeed = 2
`if boostTime <10 then movespeed = 4
`if boostTime=0 then boostTime=10
if controlkey()=1
dec shotdelay, 1
endif
if shotdelay =1
inc shots, 1
make object sphere shots, 4
position object shots, object position x(1000), object position y(1000),object position z(1000)
if shotdelay=1
shotdelay=5
endif
endif
for n = 1 to shots
If Object Exist(n) = 1
Move Object up n, 2
If Object In Screen(n) = 0
Delete Object n
EndIf
EndIf
Next n
sync
loop
obviously the problem is that each bullet/sphere has a unique object number that will eventually conflict with anything else I put in later - enemies, etc. I'm pretty sure an array is the answer but just can't figuer it out. any help is most appreciated as its driving me crazy.
Any help is GREATLY appreciated.
Cheers.
[Mod Edit] Corrected Code Tags - TDK