Jump to content
Retro Lord

Can't get debounce routine working

Recommended Posts

I'm having some problems with getting a debounce routine working so that the player can't just hold down the fire button. What am I doing wrong?

 

The f counters are used for animation. When the player presses the button I want the second frame of the animation to show and then revert too the first frame.

  drawscreen

 if joy0fire then f=20 else f=10

 if f=20 then goto skip

skip

  goto main

Share this post


Link to post
Share on other sites

Great example! Didn't know the routine was called repetition restrainer. I have another related question. How would I go about making the second animation frame last for about 1 second in this example? Not sure a f=f+1 counter would work?

  drawscreen

 if f=20 then f=10

   if !joy0fire then _Bit1_FireB_Restrainer{1} = 0 : goto __Skip_Fire

   if _Bit1_FireB_Restrainer{1} then goto __Skip_Fire

   _Bit1_FireB_Restrainer{1} = 1

   f=20 : score=score+1

__Skip_Fire

  goto main
Edited by Retro Lord

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...