Hi all,
For my new space game it is necessary to be able to use Keydown() when fireing whitout creating a new shot every frame...
In general it's easy to realize this by a code like this:
firedelay# = firedelay# - time_var# (frame indepandet variable)
if keydown(57) and firedelay# <= 0
"fire"
firedelay# = 1
endif
But because I use functions this wont work because "firedelay#" is not saved until the next frame.
So I thought I could use an extra Type;field like shot\firedelay# instead of simply firedelay#
But now Blitz wants me to set For shot.shot = each shot
and the function "fire" wont work any more.
Function feuer_frei()
For s.schuss = Each schuss
If KeyDown(57) And s\fire_delay# <= 0
s\fire_delay# = 1
fire_shot()
PlaySound(feuer)
EndIf
move_shot()
Next
End Function
I hope you got what I mean and please excuse the awful german-english mixed code :-)
For my new space game it is necessary to be able to use Keydown() when fireing whitout creating a new shot every frame...
In general it's easy to realize this by a code like this:
firedelay# = firedelay# - time_var# (frame indepandet variable)
if keydown(57) and firedelay# <= 0
"fire"
firedelay# = 1
endif
But because I use functions this wont work because "firedelay#" is not saved until the next frame.
So I thought I could use an extra Type;field like shot\firedelay# instead of simply firedelay#
But now Blitz wants me to set For shot.shot = each shot
and the function "fire" wont work any more.
Function feuer_frei()
For s.schuss = Each schuss
If KeyDown(57) And s\fire_delay# <= 0
s\fire_delay# = 1
fire_shot()
PlaySound(feuer)
EndIf
move_shot()
Next
End Function
I hope you got what I mean and please excuse the awful german-english mixed code :-)