+atari2600land Posted July 9, 2006 Share Posted July 9, 2006 I'm trying to make a menu with numbers like the Sudoku 2600 games where if you press fire, the number changes. When I put in this code, whenever I press fire, it goes through all 9 numbers in succession rapidly (I only put 3 here in this code to give a sample of what I have so far) until I let go of fire. What do I change from this code to make it once I press fire the number changes only once regardless of how long I keep holding down fire? 20 COLUBK=70 : COLUP0=128 25 x=20 : y=20 28 drawscreen 30 player0x=x : player0y=y 40 player0: %00100 %00100 %00100 %00100 %00100 end 51 if joy0fire then goto 53 52 goto 20 53 COLUBK=70 : COLUP0=128 54 x=20 : y=20 55 drawscreen 56 player0x=x : player0y=y 57 player0: %11111 %01000 %00100 %10010 %01100 end 58 if joy0fire then goto 60 59 goto 53 60 COLUBK=70 : COLUP0=128 61 x=20 : y=20 62 drawscreen 63 player0x=x : player0y=y 64 player0: %01110 %10001 %00110 %10001 %01110 end 65 if joy0fire then goto 20 66 goto 60 Quote Link to comment https://forums.atariage.com/topic/90362-number-menu-question/ Share on other sites More sharing options...
CPFace Posted July 9, 2006 Share Posted July 9, 2006 Here's one way to do it. I used z as a flag to tell the program when it's okay to advance the number counter. In this case, if z=0, then it's okay to advance. If z=1, then we're waiting for the player to release the fire button before we advance the counter again. Every time you check the fire button, you also check z. Set it to 1 if the fire button's held, set it to 0 if it's not. Depending on how tight you are for variables in your game, you'll probably want to look into implementing the flag with bitwise operators. z = 0 20 COLUBK=70 : COLUP0=128 25 x=20 : y=20 28 drawscreen 30 player0x=x : player0y=y 40 player0: %00100 %00100 %00100 %00100 %00100 end 51 if joy0fire && z=0 then z=1: goto 53 if !joy0fire && z=1 then z=0 52 goto 20 53 COLUBK=70 : COLUP0=128 54 x=20 : y=20 55 drawscreen 56 player0x=x : player0y=y 57 player0: %11111 %01000 %00100 %10010 %01100 end 58 if joy0fire && z=0 then z=1: goto 60 if !joy0fire && z=1 then z=0 59 goto 53 60 COLUBK=70 : COLUP0=128 61 x=20 : y=20 62 drawscreen 63 player0x=x : player0y=y 64 player0: %01110 %10001 %00110 %10001 %01110 end 65 if joy0fire && z=0 then z=1: goto 20 if !joy0fire && z=1 then z=0 66 goto 60 Quote Link to comment https://forums.atariage.com/topic/90362-number-menu-question/#findComment-1098602 Share on other sites More sharing options...
+atari2600land Posted July 9, 2006 Author Share Posted July 9, 2006 Thank you, CPFace. Now all I have to do is find a use for this new skill. Repeating this 80 more times probably won't make a Sudoku game, will it? Quote Link to comment https://forums.atariage.com/topic/90362-number-menu-question/#findComment-1098629 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.