Captain Spazer Posted December 14, 2016 Share Posted December 14, 2016 (edited) Having a small bit of trouble with my pfscores, I'm doing a silly sumo game where player 1 & 2 mash buttons and try to push each other out of the sumo ring and when a sumo is pushed outside the game pauses for 1 second, removes a pfscore block from the losing player and resets for the next round, but the pfscore just scrolls like mad when a sumo goes outside the ring, any thoughts on what I did wrong? This is the code that handles the sumo positions. When a sumo goes outside q goes from 0 to 1, locking the controls and reduces a pfscore, then goes to q=2 to stop it from the mad pfscore scrolling but it dosn't quite work. if player0x=54 then q=1 : pfscore1=pfscore1-1 : q=2 if player1x=91 then q=1: pfscore2=pfscore2-1 : q=2 if q>0 then k=k+1 if q>0 && k=60 then goto begin EDIT Silly me, I forgot it's pfscore1 = pfscore1/4....Works fine now. On a sidenote, I can't figure out how to limit the firebutton properly so the players can't hold them down? Edited December 14, 2016 by Captain Spazer Quote Link to comment Share on other sites More sharing options...
bogax Posted December 14, 2016 Share Posted December 14, 2016 On a sidenote, I can't figure out how to limit the firebutton properly so the players can't hold them down? Assuming you mean you want something to happen once when the fire button is pressed and not happen again until the fire but is (released and) pressed again check the state of the fire button and if it wasn't pressed last time and is pressed this time do whatever save the current state for the next check something like if joy0fire && previous_state = 0 then do_something = 1 previous_state = 0 if joy0fire then previous_state = 1 if do_something then go_do_it ; or temp1 = previous_state previous_state = 0 if joy0fire then previous_state = 1 if temp1 = 0 && previous_state = 1 then go_do_something Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted December 15, 2016 Share Posted December 15, 2016 On a sidenote, I can't figure out how to limit the firebutton properly so the players can't hold them down? The bB page has a section on that: randomterrain.com/atari-2600-memories-batari-basic-commands.html#repetition_restrainer_for_fire_button Quote Link to comment Share on other sites More sharing options...
Captain Spazer Posted December 16, 2016 Author Share Posted December 16, 2016 (edited) Hm, I must be doing something wrong, I can't really get the code to take effect. ;*************************************************************** ; ; Fire button check. ; ;``````````````````````````````````````````````````````````````` ; Turns off restrainer bit and skips this section if button is ; not pressed. ; if !joy0fire then _Bit0_FireB_Restrainer{1} = 0 : goto __Skip_Fire ;``````````````````````````````````````````````````````````````` ; Skips this section if button hasn't been released after ; being pressed. ; if _Bit0_FireB_Restrainer{1} then goto __Skip_Fire ;``````````````````````````````````````````````````````````````` ; Turns on restrainer bit for fire button and turns on ; missile movement bit. ; if q=0 && joy0fire then a=a+1 if a=20 then c=c+1 if c=1 then player0x=player0x+1 : player1x=player1x+1 if c=1 then c=0 __Skip_Fire Did I place my code wrong? a is for sprite animation q is for checking if the sumo is in or outside of the ring c is a limit so the sumo takes 1 step when at the last frame of the animation. Edited December 16, 2016 by Captain Spazer Quote Link to comment Share on other sites More sharing options...
Captain Spazer Posted December 17, 2016 Author Share Posted December 17, 2016 (edited) How silly of me, I got it working, I did a slight misscalculation on my code. Thanks guys =) Edited December 17, 2016 by Captain Spazer Quote Link to comment Share on other sites More sharing options...
Captain Spazer Posted December 17, 2016 Author Share Posted December 17, 2016 (edited) On a related note to pfscores. I have an issue with this piece of coding. Basically it checks the positions of the sumos, if one steps out of the ring, the other player wins that round and the next round starts, all fine and dandy. When player 2 wins and player1 has lost 3 rounds, as in pfscore1=0 the game jumps to a victory screen for player2, also works fine and dandy, I did the same so that player1 would have a victory screen too, but it never initializes when pfscore2=0, how come? q= whether the game is paused or not. If q=0 the game runs, if q>0 then the game pauses. a=player0's animation. b=player1's animation. k= timer for duration of a sound effect. Any insights? if player0x<=52 then q=1 : a=30 : pfscore1 = pfscore1/4 : q=2 : player0x=53 if player1x>=92 then q=1: b=30 : pfscore2 = pfscore2/4 : q=2 : player1x=91 if q>0 then k=k+1 if q>0 && k=60 && pfscore1>0 then goto begin if q>0 && k=60 && pfscore1=0 then goto P2WINS if q>0 && k=60 && pfscore2>0 then goto begin if q>0 && k=60 && pfscore2=0 then goto P1WINS Source: Sumosource.bas Edited December 17, 2016 by Captain Spazer Quote Link to comment Share on other sites More sharing options...
Mountain King Posted December 17, 2016 Share Posted December 17, 2016 (edited) It looks like player0 and player1 are using the same q variable. If you assign a different variable to player0 and add another If statement it seems to work if player0x<=52 then z=1 : a=30 : pfscore1 = pfscore1/4 : z=2 : player0x=53 if player1x>=92 then q=1: b=30 : pfscore2 = pfscore2/4 : q=2 : player1x=91 if q>0 then k=k+1 if z>0 then k=k+1 if z>0 && k=60 && pfscore1>0 then goto begin if z>0 && k=60 && pfscore1=0 then goto P2WINS if q>0 && k=60 && pfscore2>0 then goto begin if q>0 && k=60 && pfscore2=0 then goto P1WINS oops it goes to the victory screen, but screws up player2 score. Edited December 17, 2016 by Mountain King Quote Link to comment Share on other sites More sharing options...
Captain Spazer Posted December 17, 2016 Author Share Posted December 17, 2016 Good finding, Mountain King! Everything works perfectly now =) Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted December 17, 2016 Share Posted December 17, 2016 You might also want to use bits to keep track of certain off/on conditions. Quote Link to comment Share on other sites More sharing options...
Captain Spazer Posted December 19, 2016 Author Share Posted December 19, 2016 Yeah, you'r right RandomTerrain, from now on I'll definetly be using bits more, it's really practical =) Quote Link to comment 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.