Jump to content
satyrsfaction

Reset restrainer?

Recommended Posts

I'm working on a game, and i want the player to be able to switch characters using the select switch. it changes the characters at lightning speed instead of one at a time. I tried using the reset restrainer, i don't know if I'm doing something wrong or if thats not what I should be using. any suggestions?

Share this post


Link to post
Share on other sites

The basic concept is either using bit operators as an on/off switch or you can use labels. You can use labels if you're not wanting to use bits, for instance:

mainloop

 blah
 blahblah

if switchselect then goto _restrainer

 goto mainloop

_restrainer

if !switchselect then goto _blahblahblah

 goto _restrainer

That's the basic concept, it jumps to the restrainer routine then jumps to whatever routine you're wanting when the switch is released.

Share this post


Link to post
Share on other sites
2 hours ago, TwentySixHundred said:

The basic concept is either using bit operators as an on/off switch or you can use labels. You can use labels if you're not wanting to use bits, for instance:

if switchselect then goto _restrainer

 goto mainloop

_restrainer

if !switchselect then goto _blahblahblah

 goto _restrainer

That's the basic concept, it jumps to the restrainer routine then jumps to whatever routine you're wanting on when the switch is released.

OK, this is what I did -- and its still switching heroes too fast... what am I doing wrong?

 

 
if switchselect then goto _restrainer
 
goto sprites
 
_restrainer
if !switchreset then gosub _switchhero : goto sprites
goto _restrainer
 
_switchhero
t = t + 1 : if t > var7 then t = 1 : gosub _sound2 bank5
return

Share this post


Link to post
Share on other sites
33 minutes ago, satyrsfaction said:

OK, this is what I did -- and its still switching heroes too fast... what am I doing wrong?

 

 
if switchselect then goto _restrainer
 
goto sprites
 
_restrainer
if !switchreset then gosub _switchhero : goto sprites
goto _restrainer
 
_switchhero
t = t + 1 : if t > var7 then t = 1 : gosub _sound2 bank5
return

Ok so if your condition is in the maingameloop you will want to skip the routine unless the condition is met. So as an example something like this:

 if switchselect then goto _restrainer else goto _skpblah
 
 goto sprites
 
_restrainer
 if !switchreset then gosub _switchhero : goto sprites
 goto _restrainer
 
_skpblah

_switchhero
 t = t + 1 : if t > var7 then t = 1 : gosub _sound2 bank5
 return 

I dont know exactly how your program is written so im taking a guess of whats going on

  • Like 1

Share this post


Link to post
Share on other sites

presumably you want to switch characters the first time you see the switch is pressed and ignore it if it's still pressed

ie you need to remember the switch state from last time and then change characters only if it wasn't pressed last time

and is pressed this time.

 

something like this

 

  if switchselect && enable then gosub change_character
  if switchselect then enable = 0 else enable = 1

  • Like 1

Share this post


Link to post
Share on other sites
4 hours ago, bogax said:

presumably you want to switch characters the first time you see the switch is pressed and ignore it if it's still pressed

ie you need to remember the switch state from last time and then change characters only if it wasn't pressed last time

and is pressed this time.

 

something like this

 

 

  if switchselect && enable then gosub change_character
  if switchselect then enable = 0 else enable = 1

 

that worked perfectly! thanks.

Share this post


Link to post
Share on other sites

I you want to search for it, the technical term for this kind of input treatment is 'debouncing'.

Share this post


Link to post
Share on other sites
8 minutes ago, haroldoop said:

I you want to search for it, the technical term for this kind of input treatment is 'debouncing'.

 

We switched to "Repetition Restrainer" in 2013. More info:

 

atariage.com/forums/topic/213190-demo-batman/?do=findComment&comment=2769989

 

randomterrain.com/atari-2600-memories-batari-basic-commands.html#repetition_restrainer_for_fire_button

  • Like 1

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...