KevKelley Posted September 17, 2021 Share Posted September 17, 2021 I was curious. Say I had a game that involves checking to see if the playfield is clear to beat a level. Is there a way to do something like check if var12 to var43 equal 0? Quote Link to comment https://forums.atariage.com/topic/325040-checking-multiple-playfield-variables/ Share on other sites More sharing options...
KevKelley Posted September 17, 2021 Author Share Posted September 17, 2021 My thoughts were that I could read the playfield as a data table and if a value is greater than zero than the level continues. I just cannot remember where I had seen something similar in the forums. I remember someone helped me a while back with the conveyor belt animation in Crossdock, where I believe a data table was read and used to flip a certain pfpixel on or off. I figured something like this would be similar. I plan on playing around with this on my lunch to see if I can figure something out. Quote Link to comment https://forums.atariage.com/topic/325040-checking-multiple-playfield-variables/#findComment-4906912 Share on other sites More sharing options...
+Random Terrain Posted September 17, 2021 Share Posted September 17, 2021 Seems like this might work: _My_Temp = 12 __PF_Check temp5 = var0[_My_Temp] if temp5 then goto __Done_PF_Check _My_Temp = _My_Temp + 1 if _My_Temp < 44 then goto __PF_Check goto __Level_Beat __Done_PF_Check 1 Quote Link to comment https://forums.atariage.com/topic/325040-checking-multiple-playfield-variables/#findComment-4906985 Share on other sites More sharing options...
+Karl G Posted September 17, 2021 Share Posted September 17, 2021 The playfield uses var0 - var42, not counting the scrolling row. I'd do it with a for loop personally: for temp5 = 0 to 42 if var0[temp5] > 0 then goto ____level_done next ; Level continues normally here Since this consumes a lot of cycles, you might instead consider using a variable to keep track of the number of blocks or whatever on the playfield, and decrement it every time one is destroyed. This works cleanly if you know how many you start with, and it's less than 256. 1 Quote Link to comment https://forums.atariage.com/topic/325040-checking-multiple-playfield-variables/#findComment-4906989 Share on other sites More sharing options...
KevKelley Posted September 17, 2021 Author Share Posted September 17, 2021 13 minutes ago, Random Terrain said: Seems like this might work: _My_Temp = 12 __PF_Check temp5 = var0[_My_Temp] if temp5 then goto __Done_PF_Check _My_Temp = _My_Temp + 1 if _My_Temp < 44 then goto __PF_Check goto __Level_Beat __Done_PF_Check I think this was along the lines of what I was thinking. 10 minutes ago, Karl G said: The playfield uses var0 - var42, not counting the scrolling row. I'd do it with a for loop personally: for temp5 = 0 to 42 if var0[temp5] > 0 then goto ____level_done next ; Level continues normally here Since this consumed a lot of cycles, you might also consider using a variable to keep track of the number of blocks or whatever on the playfield, and decrement it every time one is destroyed. This works cleanly if you know how many you start with, and it's less than 256. I'll probably play around with how I were to do it. I had considered keeping track of blocks but I was getting tripped up on the playfield idea. I thought just checking the playfield would be simple and not as intensive. My thoughts were to have use part of the playfield for this purpose, which is why I considered rows 12-42. The rest of the playfield would be more or less decorative or serve some minor function. I assume by keeping a variable free to keep track, I would have code where I turn off the pfpixel that just adds to that variable. I'm also thinking that if I do it that way, I could make additional levels by the reverse - by turning pixels on to a certain amount. Thanks! This gives me a start to some playing around. Hopefully I learn something! Quote Link to comment https://forums.atariage.com/topic/325040-checking-multiple-playfield-variables/#findComment-4907000 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.