I finaly have the bullet code working well in sub in the game in making but I want to see I can make it to a function to see if it would be better and plus eliminate some reduncant coding.
this is for dbpro
Function Boltwep(Startrange#,Endrange#,rechargerate,PlayerEnergy,PowerDrain,speed#,BLife#,Obj,target,main_int#)
inc main_int#
for t1 = Startrange# to Endrange#
if object visible(t1) = 0
If main_int# > rechargerate
If PlayerEnergy => PowerDrain
HPplacement(t1,obj,0,0.2,0) `angle distance z-above to below
FreeBullet(BLife# , Startrange# , Endrange#)
` if object visible(t1) = 1 then play sound 10
main_int# = 0
bullet_direction = object angle z(Obj)
zrotate object t1,bullet_direction
PlayerEnergy = PlayerEnergy - PowerDrain
show object t1
Endif
endif
endif
If Fired(t1)
For t1a = 0 to speed#
Move object t1,-0.01
thit1 = object collision(t1,target)
if thit1 = 1 then hide object t1
next t1a
dec Life(t1)
if Life(t1) = 0
Fired(t1) = 0
hide object t1
endif
endif
next t1
endfunction
But somehow its just does nothing. Is there something I forgot?