I've been playing around with the new DPC+ kernel and was having some difficulty with the multisprite collision. I couldn't find any examples of code, so I'll post what I've come up with. There's probably a more efficient way to do this, but what's nice is that this example doesn't use any of your precious variables - only temp# variables and bits. The example below is for when the ball collides with an object in which more than one object is onscreen, but you could also substitute the missile or player0 for the ball. The code basically checks for overlap between two rectangles surrounding the ball and player1 that you define. temp1 is the width of the ball, temp2 is the length of the ball, temp3 is the width of the item, temp4 is the length of the item, temp5 is player#x, temp6 is player#y. z{5} could be any bit is just there to tell you that there is overlap with that item. z{0} tells you that the collision occurred with the key, and z{1} tells you that there was a collision with a sword.
drawscreen
if collision(ball,player1) then gosub key
if collision(ball,player1) then gosub sword
key
temp3=player1x+4:temp4=player1y+14
temp5=player1x:temp6=player1y
gosub pickup
if z{5} then z{0}=1:z{5}=0
return
sword
temp3=player2x+7:temp4=player2y+4
temp5=player2x:temp6=player2y
gosub pickup
if z{5} then z{1}=1:z{5}=0
return
pickup
temp1=ballx+3:temp2=bally+7
if temp1>=temp5 && temp1<=temp3 then goto ypos
if ballx>=temp5 && ballx<=temp3 then goto ypos
return
ypos
if temp2>=temp6 && temp2<=temp4 then goto col
if bally>=temp6 && bally<=temp4 then goto col
return
col
z{5}=1
return
Edited by Byte Knight, Mon May 23, 2011 9:36 PM.