Jump to content
IGNORED

Collisions


jbs30000

Recommended Posts

The whole point of batariBASIC was to be a stepping stone towards assembly. However, reality is complicated. The assembly guys are too busy with their own projects to make bB kernels. The bB guys are too grounded in BASIC to make the transition (to assembly).

 

Regardless of advantages and disadvantages I enjoy BASIC. I even enjoy the double limitations of both the hardware (2600) and software (bB). BASIC homebrew isn't for everybody, that's for sure!

Link to comment
Share on other sites

Actually, I was thinking of the DPC+ kernel. It's just been so long I forgot the name.

 

And I have played around with assembly. I did the tutorials from Andrew Davie. Although searching, I see he's done more lately.

 

Anyway, is collision detection on the DPC+ kernel still buggy for sprites 2 - 5? Thank you.

Link to comment
Share on other sites

...

 

Anyway, is collision detection on the DPC+ kernel still buggy for sprites 2 - 5? Thank you.

I only have ever used bB DPC+ kernel, and I haven't used it enough to answer your question.

I think I remember reading there is some way to see what collided with sprites 2-5.

One of the last things added was a way to color the missile differently when it is not horizontal with its player. It only seem to work for me when the missile was below the player, above was black.

Also defining a range of players to the same data was added.

Scrolling was going to be the next thing, but seemed to have stopped development about a year ago.

Some very impressive games can be done with the DPC+ bB tools we have now, but so far only a few have been completed.

Link to comment
Share on other sites

You could do some kind of soft collisions, though it would, of course, take more processing power. Start at the location of the sprite, then check if something is within the range of spritex - 1/2 sprite width and spritey - 1/2 sprite height to spritex + 1/2 sprite width and spritey + 1/2 sprite height.

Link to comment
Share on other sites

And I have played around with assembly. I did the tutorials from Andrew Davie. Although searching, I see he's done more lately.

 

Has he done more than what is here:

 

www.randomterrain.com/atari-2600-memories.html#assembly_language

 

I better get back to work if he's added more.

Link to comment
Share on other sites

I guess session 25 is the only one that's new.

 

OK, and as for collisions, that last time I played around I had to use sprite locations to detect virtual sprite collisions (and that should be sprites 2-9 instead of 2-5, my mistake).

 

One last question then. When was the last time the DPC+ kernel was updated? The last time I did anything with bB was about 8 months ago.

Edited by jbs30000
Link to comment
Share on other sites

I think only Byte Knight would have a straight answer. He's done serious work with DPC+

http://www.atariage....pgraded-to-dpc/

 

I think he might even have some source in that topic. Maybe (if it's there) we could peek at his code to see how he handles collisions.

 

My workaround is to check sprite x and y positions for overlap using temp variables. The example is for a collision between player1 and player0, but you could use it for any of the players. The routine will return a temp1 value of 200 if there is a collision. I'm sure there's a more efficient way of coding this, but it works well.

 

pickupkey
temp3=player1x+6:temp4=player1y+14
temp5=player1x:temp6=player1y
gosub pickup
if temp1<>200 then return thisbank
z{0}=1:temp1=0:r=%00000010:q=11
return thisbank

pickup
temp1=player0x+7:temp2=player0y+29
if temp5>=player0x && temp5<=temp1 then goto ypos
if temp3>=player0x && temp3<=temp1 then goto ypos
return thisbank
ypos
if temp6>=player0y && temp6<=temp2 then goto col
if temp4>=player0y && temp4<=temp2 then goto col
return thisbank
col
temp1=200
return thisbank

Link to comment
Share on other sites

Couldn't that be a function like this:

 

 function softcol_player0
rem x1 as player0x, y1 as player0y, x2 as temp1, y2 as temp2, x3 as temp3, y3 as temp4, x4 as temp5, y4 as temp6
if player0x > temp5 then return 0
if temp1 < temp3 then return 0
if player0y > temp6 then return 0
if temp2 < temp4 then return 0
return 1
end
Link to comment
Share on other sites

Yeah, the last program I was working on uses sprite positions to check for collisions.

 

So has there been any DPC+ kernel updates lately, or will there be? Just curious.

 

That's a question for batari. I know he had planned for more features regarding the DPC+ kernel. One was making the extra EEPROM on Melody boards accessible for graphic data.

Link to comment
Share on other sites

Couldn't that be a function like this:

 

 function softcol_player0
rem x1 as player0x, y1 as player0y, x2 as temp1, y2 as temp2, x3 as temp3, y3 as temp4, x4 as temp5, y4 as temp6
if player0x > temp5 then return 0
if temp1 < temp3 then return 0
if player0y > temp6 then return 0
if temp2 < temp4 then return 0
return 1
end

 

That's good thinking! I hadn't thought to use the function command. This works better for my example:

 




pickupkey
temp3=player1x+6:temp4=player1y+14
temp5=player1x:temp6=player1y
temp1=pickup(f)
if temp1<>200 then return thisbank
z{0}=1:temp1=0:r=%00000010:q=11
return thisbank


function pickup
temp1=player0x+7:temp2=player0y+29
if player0x > temp3 then return 0
if temp1 < temp5 then return 0
if player0y > temp4 then return 0
if temp2 < temp6 then return 0
return 200

Link to comment
Share on other sites

That's good thinking! I hadn't thought to use the function command. This works better for my example:

 




pickupkey
temp3=player1x+6:temp4=player1y+14
temp5=player1x:temp6=player1y
temp1=pickup(f)
if temp1<>200 then return thisbank
z{0}=1:temp1=0:r=%00000010:q=11
return thisbank


function pickup
temp1=player0x+7:temp2=player0y+29
if player0x > temp3 then return 0
if temp1 < temp5 then return 0
if player0y > temp4 then return 0
if temp2 < temp6 then return 0
return 200

 

Just to clarify for the studio audience, the lines:

temp3=player1x+6:temp4=player1y+14

 

and

temp1=player0x+7:temp2=player0y+29

 

refer to the far sides of the object being compared. (right?)

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...