Ultimate Amiga

Network Boards => AMOS Language Discussion => AMOS Factory => AMOS Forum => Topic started by: xboxisfinished on February 25, 2019, 05:55:39 AM

Title: How to prevent multiple fire button event...
Post by: xboxisfinished on February 25, 2019, 05:55:39 AM
I am writing a tic tac toe game and so far I have managed to do 98% of the joystick event, checking to see if you already placed a piece there and to avoid moving the character outside the board. My problem is when you start the game the first time only and only the first time and you press the joystick button and you keep holding the joystick button it places both player 1 and 2 at the same spot. But after that it works normally no matter how hard you press the joystick button it will not place player 1 and player 2 on the same spot if it is occupied by either player.

So my question is how to make it that you need to physically left your finger and press the joystick button in order for it to trigger again and refuse to trigger joystick button when you keep holding the joystick button?

Thanks in advance.
Title: Re: How to prevent multiple fire button event...
Post by: Volvo_0ne on February 26, 2019, 06:19:19 PM
J=Joy(1)
If J=16
      Repeat : Wait 5 : Until Not Joy(1)
      Rem Do whatever "fire" does here.
Endif

Should do it (adjust the Wait period as needed)

Title: Re: How to prevent multiple fire button event...
Post by: xboxisfinished on February 27, 2019, 01:52:46 AM
J=Joy(1)
If J=16
      Repeat : Wait 5 : Until Not Joy(1)
      Rem Do whatever "fire" does here.
Endif

Should do it (adjust the Wait period as needed)
Duuh! - slaps forehead - I  cannot believe I have not thought of that! - sigh - And I call myself a programmer!

THANK YOU SO MUCH!! :D