Jump to content
IGNORED

Batari Basic peculiar


MissCommand

Recommended Posts

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 by MissCommand
Link to comment
Share on other sites

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 by MissCommand
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 by MissCommand
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...