Hi, I’m trying to make a turret shoot 10 bullets in 2 second with only 1 press of a key.
Right now I’ve done this:
The problem here is that it shoots only 1 bullet and I don’t know what to do; I’ve tried using “press button” instead of release and it subtracts more than 1 ammo; I’ve tried adding “trigger only once” and it shot only 1 bullet again. I really don’t know what to do anymore. Help please
Hello,
I don’t know how a wait event behave inside a repeat event. But here’s my supposition :
Maybe after 0.22 waiting, the key is no longer pressed.
So what I’d do is:
When key pressed, change variable “shooting”
When variable shooting is this or that, then → your event creating bullets and shooting.
The variable shooting could be a boolean value true/false. But how would you set it to false after shouting and waiting 10 times…?
So I would do this:
- if key pressed, trigger once, set variable(shooting) to 10.
- if Variable(shooting) > 0, then shoot actions and subtract 1 to variable(shooting).
So after shooting 10 times, variable(shooting) will be 0, so it will stop to shoot.
This is just a supposition I don’t know how wait event works, and how it works inside a repeat event.
Thank you for your answer, unfortunately (or luckily perhaps) I solved it and I don’t even know how I got it, so I’m gonna post how I did it in case someone needs it.
There are various variables and timers but I think the core is understandable.
1 Like