Ultimate Amiga

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: How to prevent multiple fire button event...  (Read 3084 times)

0 Members and 1 Guest are viewing this topic.

xboxisfinished

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 205
  • Generic Amiga User
    • gamemakermagazine.com
How to prevent multiple fire button event...
« 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.
Logged

Volvo_0ne

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 71
  • A1200 lover
Re: How to prevent multiple fire button event...
« Reply #1 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)

« Last Edit: February 26, 2019, 06:23:05 PM by Volvo_0ne »
Logged
Transuranic heavy elements may not be used where there is life.

xboxisfinished

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 205
  • Generic Amiga User
    • gamemakermagazine.com
Re: How to prevent multiple fire button event...
« Reply #2 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
Logged
Pages: [1]   Go Up
 

TinyPortal 2.2.2 © 2005-2022