Jump to content
IGNORED

Playfield collision detection


karnov

Recommended Posts

Is playfield,player collision detection impossible using the multisprite kernel?

Thanks!

The collisions work regardless of the kernel, meaning the TIA will set the collision bits regardless. It's figuring out which player was involved in the collision that's the problem, since player1 gets reused to draw player2 through player5. So collision(playfield,player0) is fine, but collision(playfield,player1) needs to be handled much differently. By the way, there is no collision(playfield,player2) through collision(playfield,player5), so perhaps that's what you meant by impossible?

 

If collision(playfield,player1) occurs, then you need to use some kind of logical procedure to identify which player was involved. For example, if you know that a particular player happens to be set to blanks (%00000000 on all lines) or is positioned off the screen so it doesn't show up, then you can rule it out. Otherwise, you'll need to use each player's position, combined with pfread, to see if one or more playfield pixels are turned on in the area where that player is positioned. As I understand it (I haven't tried it myself), pfread works differently for the multisprite kernel, due to the difference in the way the playfield is drawn.

 

The ideal approach would have been to clear the player1 collision bits just before displaying a new sprite, and then store them in RAM just after the sprite has finished being drawn, but the multisprite kernel probably didn't have enough free cycles per scan line to do anything like that.

 

Michael

Link to comment
Share on other sites

Thanks for answering my question, however when tinkering around with the example file that comes with the zip called ms.bas (the one with 5 movable numbers), I stuck in a:

 

if collision(playfield,player1) then player1[a]x = player1[a]x + 1 (syntax may be wrong-writing from memory)

 

and even when I completely cleared the playfield, the sprite moved right as if it was always touching the playfield. I cleared the playfield by using:

 

playfield:

................

end

 

I just started playing with the multisprite kernal so hopefully my mistake will be obvious. If I do get collision to work, can anyone point me to a good explaination of how to draw the playfield in this kernal, its not as simple as I thought, the dots and X's do not translate the way I think they will, also on an interesting note, I plugged some zeros into the playfield graphics and it compiled with strange results. Thanks and all feedback is appreciated.

Link to comment
Share on other sites

Thanks for answering my question, however when tinkering around with the example file that comes with the zip called ms.bas (the one with 5 movable numbers), I stuck in a:

 

if collision(playfield,player1) then player1[a]x = player1[a]x + 1 (syntax may be wrong-writing from memory)

 

and even when I completely cleared the playfield, the sprite moved right as if it was always touching the playfield. I cleared the playfield by using:

 

playfield:

................

end

 

What version of bB are you using? In versions < 1.0, the collision registers are not automatically cleared every frame. So to make collisions work as you expect, place CXCLR=0 before every drawscreen. Or upgrade to version 1.0, as this and many other things were fixed in the multisprite kernel.

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