ProwoodStuff Posted January 13, 2023 Share Posted January 13, 2023 I’ve been experimenting with getting more playfields on screen but hit a roadblock. That roadblock being how it gets to the next screen. Because I want it to be when a certain score is hit, it goes to the next level. The code I jotted down is: if score = 2 then goto playfield2 Is there a way to resolve the issue or is this not possible to do on the Atari 2600? Quote Link to comment https://forums.atariage.com/topic/346514-score-related-%E2%80%98if%E2%80%99-declarations-resolved/ Share on other sites More sharing options...
+Random Terrain Posted January 13, 2023 Share Posted January 13, 2023 I think this might be what you are looking for: https://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#check_score 1 Quote Link to comment https://forums.atariage.com/topic/346514-score-related-%E2%80%98if%E2%80%99-declarations-resolved/#findComment-5189516 Share on other sites More sharing options...
ProwoodStuff Posted January 13, 2023 Author Share Posted January 13, 2023 (edited) 1 hour ago, Random Terrain said: I think this might be what you are looking for: https://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#check_score When the score is obtained, nothing happens. Do I need to move stuff around at all? I'd be willing to bet I do. mainloop temp5 = _sc3 & $0F if collision(player0,missile0) then score = score + 1 temp6 = _sc3 & $0F if collision(player0,missile0) then missile0y = 134 if player0x=161 then player0x=1 if joy0up then player0y = player0y - 1 if joy0down then player0y = player0y + 1 if joy0left then player0x = player0x - 1 if joy0right then player0x = player0x + 1 if _sc1 = $00 && _sc2 = $00 && _sc3 > $02 then goto playfield2 drawscreen goto mainloop end The Missile moving is temporary until it changes to the next playfield. Edited January 13, 2023 by ProwoodStuff Adding more context to a certain line of code Quote Link to comment https://forums.atariage.com/topic/346514-score-related-%E2%80%98if%E2%80%99-declarations-resolved/#findComment-5189535 Share on other sites More sharing options...
+Random Terrain Posted January 13, 2023 Share Posted January 13, 2023 Try this: dim _sc1 = score dim _sc2 = score+1 dim _sc3 = score+2 scorecolor = $FA __Main_Loop ; if collision(player0,missile0) then missile0y = 134 : score = score + 1 if player0x > 160 then player0x = 1 if c then c = c - 1 if !joy0up then c = 0 : goto __Skip_Joy0_Up player0y = player0y - 1 if !c then score = score + 1 : c = 45 __Skip_Joy0_Up if joy0down then player0y = player0y + 1 if joy0left then player0x = player0x - 1 if joy0right then player0x = player0x + 1 if _sc1 = $00 && _sc2 = $00 && _sc3 > $01 then c = 45 : COLUBK = $B4 : goto __Playfield_02 drawscreen goto __Main_Loop __Playfield_02 if c then c = c - 1 : if !c then COLUBK = 0 : score = 0 : goto __Main_Loop drawscreen goto __Playfield_02 For this test, I deactivated the collision code and made pushing up on the joystick increase the score. When it hits 2, the screen changes color. 1 Quote Link to comment https://forums.atariage.com/topic/346514-score-related-%E2%80%98if%E2%80%99-declarations-resolved/#findComment-5189600 Share on other sites More sharing options...
ProwoodStuff Posted January 13, 2023 Author Share Posted January 13, 2023 10 hours ago, Random Terrain said: Try this: dim _sc1 = score dim _sc2 = score+1 dim _sc3 = score+2 scorecolor = $FA __Main_Loop ; if collision(player0,missile0) then missile0y = 134 : score = score + 1 if player0x > 160 then player0x = 1 if c then c = c - 1 if !joy0up then c = 0 : goto __Skip_Joy0_Up player0y = player0y - 1 if !c then score = score + 1 : c = 45 __Skip_Joy0_Up if joy0down then player0y = player0y + 1 if joy0left then player0x = player0x - 1 if joy0right then player0x = player0x + 1 if _sc1 = $00 && _sc2 = $00 && _sc3 > $01 then c = 45 : COLUBK = $B4 : goto __Playfield_02 drawscreen goto __Main_Loop __Playfield_02 if c then c = c - 1 : if !c then COLUBK = 0 : score = 0 : goto __Main_Loop drawscreen goto __Playfield_02 For this test, I deactivated the collision code and made pushing up on the joystick increase the score. When it hits 2, the screen changes color. All it’s giving me is what I can only describe as a late 1800’s video but without the video and only the tape. FullSizeRender.MOV I’m probably going to start from scratch and see if I can optimise my spaghetti code more to have it so this stuff doesn’t cause the emulator to have a breakdown Quote Link to comment https://forums.atariage.com/topic/346514-score-related-%E2%80%98if%E2%80%99-declarations-resolved/#findComment-5189885 Share on other sites More sharing options...
+Random Terrain Posted January 14, 2023 Share Posted January 14, 2023 The test program works for me using Stella. Here's the .bas file: test_01_2023y_01m_13d_2058t.bas Here's the .bin file to use with an emulator: test_01_2023y_01m_13d_2058t.bin You should see the score and pressing up should increase the score by one each time. When the score reaches 2, the background will change color, then the score will reset to 0. Quote Link to comment https://forums.atariage.com/topic/346514-score-related-%E2%80%98if%E2%80%99-declarations-resolved/#findComment-5189933 Share on other sites More sharing options...
ProwoodStuff Posted January 14, 2023 Author Share Posted January 14, 2023 I did some really minor tweaking and got it to work but it takes just about 3.84 seconds to get to playfield 2, any adjustments I could make to make it faster and efficient? mainloop if collision(player0,missile0) then missile0y = 134 : score = score + 1 if player0x > 160 then player0x = 1 if c then c = c - 1 if !joy0up then c = 0 : goto __Skip_Joy0_Up player0y = player0y - 1 if switchreset then reboot __Skip_Joy0_Up if joy0down then player0y = player0y + 1 if joy0left then player0x = player0x - 1 if joy0right then player0x = player0x + 1 if _sc1 = $00 && _sc2 = $00 && _sc3 = $02 then c = 45 : COLUBK = $B4 : goto __Playfield_02 drawscreen goto mainloop end __Playfield_02 if c then c = c + 1 : if !c then COLUBK = 0 : score = 3 : goto mainloop goto __Playfield_02 end Quote Link to comment https://forums.atariage.com/topic/346514-score-related-%E2%80%98if%E2%80%99-declarations-resolved/#findComment-5190022 Share on other sites More sharing options...
+Random Terrain Posted January 14, 2023 Share Posted January 14, 2023 The text example program slows stuff down using a counter to make it easier for you to see what is happening. You wouldn't use that counter or the color changes in your actual program. It would look more like this after the extra test code is removed: __Main_Loop if collision(player0,missile0) then missile0y = 134 : score = score + 1 if joy0up then player0y = player0y - 1 if joy0down then player0y = player0y + 1 if joy0left then player0x = player0x - 1 if joy0right then player0x = player0x + 1 if player0x > 160 then player0x = 1 if _sc1 = $00 && _sc2 = $00 && _sc3 > $01 then goto __Playfield_02 drawscreen goto __Main_Loop __Playfield_02 ; More of your code goes here 1 Quote Link to comment https://forums.atariage.com/topic/346514-score-related-%E2%80%98if%E2%80%99-declarations-resolved/#findComment-5190026 Share on other sites More sharing options...
ProwoodStuff Posted January 14, 2023 Author Share Posted January 14, 2023 1 minute ago, Random Terrain said: The text example program slows stuff down using a counter to make it easier for you to see what is happening. You wouldn't use that counter or the color changes in your actual program. It would look more like this after the extra test code is removed: __Main_Loop if collision(player0,missile0) then missile0y = 134 : score = score + 1 if joy0up then player0y = player0y - 1 if joy0down then player0y = player0y + 1 if joy0left then player0x = player0x - 1 if joy0right then player0x = player0x + 1 if player0x > 160 then player0x = 1 if _sc1 = $00 && _sc2 = $00 && _sc3 > $01 then goto __Playfield_02 drawscreen goto __Main_Loop __Playfield_02 ; More of your code goes here ah, well that's why lol. Thanks for all the help. I'll try and take it from here now that I have a basic understanding. I'll post again if stuff goes sideways Quote Link to comment https://forums.atariage.com/topic/346514-score-related-%E2%80%98if%E2%80%99-declarations-resolved/#findComment-5190028 Share on other sites More sharing options...
+Gemintronic Posted January 17, 2023 Share Posted January 17, 2023 As a side I find that using the score can be harder than just using a plain old variable. Less gotchas and more flexible options for performing math. As an example: if you get points for crashing into an enemy car you could also use a separate variable to tally up each crash. After 10 crashes then go to the next screen. 3 Quote Link to comment https://forums.atariage.com/topic/346514-score-related-%E2%80%98if%E2%80%99-declarations-resolved/#findComment-5191702 Share on other sites More sharing options...
KevKelley Posted January 17, 2023 Share Posted January 17, 2023 56 minutes ago, Gemintronic said: As a side I find that using the score can be harder than just using a plain old variable. Less gotchas and more flexible options for performing math. As an example: if you get points for crashing into an enemy car you could also use a separate variable to tally up each crash. After 10 crashes then go to the next screen. So true. I based some of my earlier games difficulty progression on score and found it to cause more issues or be not as precise. Now I have a variable or two that tally things for me that will flip bits or trigger things to happen. 3 Quote Link to comment https://forums.atariage.com/topic/346514-score-related-%E2%80%98if%E2%80%99-declarations-resolved/#findComment-5191728 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.