|
Post by salgue79 on Feb 17, 2020 17:35:45 GMT
Hi!! I write from Spain. I have a problem, and I would like to reduce the rate of fire. When shooting, many shots come out at once, and what I'm looking for, is that one shot comes out, and that at the end of that shot, another one can come out. Not that many come out at once. I would also like to know how to do so that the shot did not reach as much. For example, that it was a sword and not very long. Thank you very much in advance!! Attachments:
|
|
|
Post by lamptonworm on Feb 21, 2020 13:20:13 GMT
Hi,
I can't reply in detail at the moment, but this pseudo code may give you some help. This is just theory and not AGD code. You basically need to use a variable to determine if you can spawn a bullet or not, and some counter to manage the time between being able to fire.
To adapt for AGD, "CAN_SHOOT" could use the player variable SETTINGA, and for RELOAD_TIMER use a general variable e.g. R.
** Player **
IF KEY_FIRE = TRUE IF CAN_SHOOT = TRUE SPAWN BULLET LET CAN_SHOOT = FALSE ENDIF ENDIF
IF CAN_SHOOT = FALSE ADD 1 TO RELOAD_TIMER IF RELOAD_TIMER > 10 RELOAD_TIMER = 0 CAN_SHOOT = TRUE ENDIF ENDIF
Cheers, LW.
|
|
|
Post by salgue79 on Mar 5, 2020 12:44:01 GMT
THANKS!!!!
|
|
|
Post by Packobilly on Mar 6, 2020 9:36:11 GMT
Hola, Salgue79. También puedes utilizar una pequeña rutina condicionante.
IF A = 10 (puedes modificar este valor para mayor o menor frecuencia de disparo) LET A = 0 ELSE ADD 1 TO A ENDIF
Luego en la parte donde tienes el disparo...
IF KEY 4 (por ejemplo) IF A = 0 LASER DIRECTION ENDIF ENDIF
De esta manera tienes el contador A que, en este ejemplo, va de 0 a 10, y solo sale la bala cuando A = 0. (Puedes modificar el valor de A a tu gusto, como te comenté más arriba) No sé si te entendí, pero espero que te sirva. Un saludo y suerte!
|
|