MissCommand Posted September 29, 2017 Share Posted September 29, 2017 (edited) Hello all, Slowly working on my game (decided on name... Mall Rush!) and having a very peculiar problem. Been staring at this a few days now and before totally rewriting to find a different way to code, thought I would see if anyone had a solution (or explanation): Using DPC+. I have sprites "falling" and my player0 at the bottom dodging. I have a special sprite (player7) that I want to collect and not dodge. Distilled below: So when I detect a collision: Main loop: ;*** Check for collisions if collision(player0,player1) then goto _End_Coll _Return_CollGift continue _End_Coll if player7y > 149 && player7y < 166 then gencount = 1 else goto _Return_CollGift score = score + 200 Ch0_Sound = 5 : Ch0_Duration = 1 : Ch0_Counter = 0 ; Play Adventure Grab goto _Return_CollGift This works great for testing... It detects the player7 position on my bottom row and adds score and plays sound. So now when I actually want player0 to lose a life when colliding with anything else I just redirect the goto to a differnt location instead back to the main loop: _End_Coll if player7y > 149 && player7y < 166 then gencount = 1 else goto _End_Life score = score + 200 Ch0_Sound = 5 : Ch0_Duration = 1 : Ch0_Counter = 0 ; Play Adventure Grab goto _Return_CollGift _End_Life do stuff goto _Return_CollGift And now every collision is sending me to _End_Life! Im not sure how changing a goto location is causing my if statement to work different and not evaluate player7 position correctly. I must be doing something dumb and just not catching it. Help! Edited September 29, 2017 by MissCommand Quote Link to comment Share on other sites More sharing options...
+Karl G Posted September 29, 2017 Share Posted September 29, 2017 Without seeing the rest of your source, I can only make a guess, but the first thing I would suggest trying is renaming your _End_Life label to not have the word "end" in it. I've had issues with labels containing keyword before. Quote Link to comment Share on other sites More sharing options...
+atari2600land Posted September 30, 2017 Share Posted September 30, 2017 The problem with the "end" in a label is if it's the first word in it. Something like "please_end_coll" would work. Quote Link to comment Share on other sites More sharing options...
MissCommand Posted October 2, 2017 Author Share Posted October 2, 2017 (edited) Thanks for the suggestions guys! As RandomTerrain and others suggest, I do use underscores in front of all my labels. After much aggravation I finally realized the problem. The collision routine is actually being called TWICE because I did not remove player7 completely from my internal list. The first time through it works correctly, but I did not notice because the "partial" remove I did called the collision to work opposite the second time... so I did not notice the first pass through. I finally realized what was going on when I noticed the score was being incremented even though it was not supposed to. Ugh! Edited October 2, 2017 by MissCommand Quote Link to comment Share on other sites More sharing options...
MissCommand Posted October 4, 2017 Author Share Posted October 4, 2017 Actually, after more testing that was only partially the problem... ugh! Can anyone tell me how to monitor the numerical position of a particular sprite? Either through setting the score or through the Stella debugger? Thanks! Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted October 4, 2017 Share Posted October 4, 2017 Actually, after more testing that was only partially the problem... ugh! Can anyone tell me how to monitor the numerical position of a particular sprite? Either through setting the score or through the Stella debugger? Thanks! You mean like what is in these example programs? randomterrain.com/atari-2600-memories-batari-basic-commands.html#testvariables randomterrain.com/atari-2600-memories-batari-basic-commands.html#find_border_coordinates randomterrain.com/atari-2600-memories-batari-basic-commands.html#ex_multisprite_9_objects randomterrain.com/atari-2600-memories-batari-basic-commands.html#ex_dpc_13_objects Quote Link to comment Share on other sites More sharing options...
MissCommand Posted October 4, 2017 Author Share Posted October 4, 2017 (edited) You mean like what is in these example programs? randomterrain.com/atari-2600-memories-batari-basic-commands.html#testvariables Exactly like your first link! Thanks! It did reveal something really interesting... the collision detection appears to be happening a few pixels above where I think it should be. My sprite starts at y-position 150 (16 pixels high), but the collision triggers start at y-position142. Strange. Edited October 4, 2017 by MissCommand 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.