Can anyone help with this magazine code. it goes down but i want it to shoot only when the shootwait variable is smaller than 1.
here is the code
main.dba
Rem Project: Basic Top down shooter
Rem Created: 1/15/2008 12:14:24 PM
Rem ***** Main Source File *****
sync on
sync rate 30
make object sphere 1,20
sc_setupobject 1, 0, 2
make object sphere 3, 20
sc_setupobject 3, 0, 2
make object sphere 2, 5
position object 2, 35, 35, 599
position object 3, 35,35,35
position object 1, object position x(3),object position y(3),object position z(3)
`load sound "fire.wav", 1
`load sound "reload.wav", 2
herohealth# = 100
shoot#=0
shot#=0
bullet#=0
gunmag#=12
gunbullets#=24
shootwait=30
do
dec shootwait, 1
ammo()
setuphero(herohealth#, 1)
movehero(3, 2)
camerasteup()
shoot(1)
bulletthink()
if spacekey()=1 then dec herohealth#, 1
collision2()
sync
loop
function camerasteup()
position camera object position x(1), object position y(1)+300, object position z(1)
point camera object position x(1), object position y(1), object position z(1)
endfunction
function ammo()
if returnkey()=1 and shootwait<0
dec gunmag#, 1
shootwait=30
endif
endfunction
make memblock 1, 255
shooting.dba
function shoot(parentobject#)
if returnkey()=1 and shootwait<1
rotate object 2, object angle x(1), object angle y(1), object angle z(1)
position object 2, object position x(parentobject#), object position y(parentobject#), object position z(parentobject#)
`play sound 1
show object 2
endif
endfunction
function bulletthink()
if object position x(2)=45 then move object 2, 0
if object position y(2)=45 then move object 2, 0
if object position z(2)=599 then move object 2, 0
move object 2, 5
endfunction
come see night shift at http://forum.thegamecreators.com/?m=forum_view&t=106003&b=25 see you there