Words Fail Posted December 21, 2022 Share Posted December 21, 2022 Scenario: I draw a playfield at the start of a level, you fly over some of that play field causing it to disappear. Is there a way I can turn the playfield off and then back on while remembering its previous state of which blocks you made disappear already? 1 Quote Link to comment Share on other sites More sharing options...
+Gemintronic Posted December 21, 2022 Share Posted December 21, 2022 In the standard kernel you can access the playfield as variables using var0-47. So, you can copy chunks of the playfield and save them for later. https://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#standardmemorymap Problem is: you only have 26 normal variables to play with and the playfield itself is made up of more variables than that. You could reduce the playfield to 6 rows and use the left over vars as a backup copy of the playfield. A little chunky looking but doable. https://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#pfres 1 Quote Link to comment Share on other sites More sharing options...
Words Fail Posted December 21, 2022 Author Share Posted December 21, 2022 2 hours ago, Gemintronic said: In the standard kernel you can access the playfield as variables using var0-47. So, you can copy chunks of the playfield and save them for later. https://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#standardmemorymap Problem is: you only have 26 normal variables to play with and the playfield itself is made up of more variables than that. You could reduce the playfield to 6 rows and use the left over vars as a backup copy of the playfield. A little chunky looking but doable. https://www.randomterrain.com/atari-2600-memories-batari-basic-commands.html#pfres I think I'll just skip this all together, although I am going to be switching to DPC+ shortly if that makes a difference. Here's the idea.. there's a Pac-Man bootleg called Piranha where you move a fish around. On some of the levels the dots or level disappears (I can't remember) disappear. I was going to have my blocks show for 3 seconds, disappear for 3, show for 3, etc. You can only get them when they're on. Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted December 21, 2022 Share Posted December 21, 2022 Maybe I'm not reading your question correctly, but if you want everything to disappear, can't you make the foreground the color of the background? Then restore the color when you want it to appear again? 3 Quote Link to comment Share on other sites More sharing options...
KevKelley Posted December 22, 2022 Share Posted December 22, 2022 2 hours ago, Random Terrain said: Maybe I'm not reading your question correctly, but if you want everything to disappear, can't you make the foreground the color of the background? Then restore the color when you want it to appear again? And building on this idea couldn’t you have the collision detection and deletion be conditional on the color value of the playfield? 2 Quote Link to comment Share on other sites More sharing options...
+Al_Nafuur Posted December 22, 2022 Share Posted December 22, 2022 14 hours ago, Words Fail said: Scenario: I draw a playfield at the start of a level, you fly over some of that play field causing it to disappear. Is there a way I can turn the playfield off and then back on while remembering its previous state of which blocks you made disappear already? To toggle a single playfield pixel you can use pfpixel with the flip parameter. If you flip it even times it will have the same state as before your blinking, with odd time it will have the opposite value. This is not recommendable for a large amount of playfield pixel, because it needs 80 CPU cycles. You can invert a whole byte (8 pixel) with the ASM command "eor" and the original bytes value. e.g.: asm lda var20 ; your playfield byte in RAM eor %10101010 ; invert with original bitmask on accumulator sta var20 ; store back to RAM end This will only cost you 8 CPU cycles per byte If you want to blink the whole playfield the color trick described by @Random Terrain and @KevKelley is the best way to do it. 3 Quote Link to comment Share on other sites More sharing options...
KevKelley Posted December 22, 2022 Share Posted December 22, 2022 6 hours ago, Al_Nafuur said: You can invert a whole byte (8 pixel) with the ASM co This is awesome. I love seeing the ASM equivalents of things as they help me learn and of course the trade off with saving cycles Quote Link to comment Share on other sites More sharing options...
Words Fail Posted December 23, 2022 Author Share Posted December 23, 2022 On 12/21/2022 at 6:43 PM, Random Terrain said: Maybe I'm not reading your question correctly, but if you want everything to disappear, can't you make the foreground the color of the background? Then restore the color when you want it to appear again? You're right! I can't believe I didn't think of that. 1 Quote Link to comment Share on other sites More sharing options...
Words Fail Posted December 23, 2022 Author Share Posted December 23, 2022 21 hours ago, KevKelley said: And building on this idea couldn’t you have the collision detection and deletion be conditional on the color value of the playfield? Yes, now that you say it. I already have my collision detection working though.. it just looks if the pixel is on or not. Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted December 23, 2022 Share Posted December 23, 2022 39 minutes ago, Words Fail said: Yes, now that you say it. I already have my collision detection working though.. it just looks if the pixel is on or not. You could have a bit turned on when collision detection is active and turn it off when it's not. If the bit is off, skip the collision detection section. Quote Link to comment Share on other sites More sharing options...
Words Fail Posted December 23, 2022 Author Share Posted December 23, 2022 24 minutes ago, Random Terrain said: You could have a bit turned on when collision detection is active and turn it off when it's not. If the bit is off, skip the collision detection section. Collision detection is always on. My program looks what x and y coordinate you are at. coldet if player0x=21 then d = 1: f = 2: goto coldet2 if player0x=23 then d = 1: f = 2: goto coldet2 if player0x=33 then d = 4: f = 5: goto coldet2 if player0x=45 then d = 7: f = 8: goto coldet2 if player0x=57 then d = 10: f = 11: goto coldet2 if player0x=69 then d = 13: f = 14: goto coldet2 if player0x=81 then d = 16: f = 17: goto coldet2 if player0x=93 then d = 19: f = 20: goto coldet2 if player0x=105 then d = 22: f = 23: goto coldet2 if player0x=117 then d = 25: f = 26: goto coldet2 if player0x=127 then d = 28: f = 29: goto coldet2 if player0x=129 then d = 28: f = 29: goto coldet2 return coldet2 if player0y=18 then e = 3: goto coldet3 if player0y=26 then e = 5: goto coldet3 if player0y=34 then e = 7: goto coldet3 if player0y=42 then e = 9: goto coldet3 if player0y=50 then e = 11: goto coldet3 if player0y=58 then e = 13: goto coldet3 if player0y=66 then e = 15: goto coldet3 if player0y=74 then e = 17: goto coldet3 if player0y=82 then e = 19: goto coldet3 return coldet3 if pfread(d,e) then pfhline d e f off: c=c-1: score = score + 50 if c=0 then goto levelend return It first checks your x pos. If it is one of those it is setting variables to tell the program which two pixels I need to turn off. Each block is made up of two blocks actually. So in this case player0x is 33 for example it's going to set variable d to 4 which is your x pos. If not one of those positions it returns. If it is then it checks your y pos.. if not one of those listed it returns.. if so then and sets variable e. If then checks if the coordinate is on or off. If it's on then it turns it off, takes variable c down, and gives you score. Once c is 0 means all blocks are gone and do level end stuff. A lot of that will probably change because I have to convert my game over to DPC+.. I'll ask about that elsewhere. Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted December 23, 2022 Share Posted December 23, 2022 If you want no collision when the foreground can't be seen, here's an example: if !_Bit0_Collision{0} then goto __Skip_Collision_Check ; Your collision code goes here __Skip_Collision_Check The _Bit0_Collision{0} bit would be on when the foreground can be seen and turned off when the foreground can't be seen. 1 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.