Post by TheSquirrelly1 on Jun 28, 2004 21:28:22 GMT -5
OK... Here goes
I have a player sprite that i'm using on a 2D side scrolling map (right now it's just a smiley face, but that's not the point )
I need to check the sprites CORNERS in order to see if it will collide with my map at any point around the sprite...
I thought I could do this by using the SprSetXCentre and SprSetYCentre functions, but I guess I was wrong...
What I need to do is be able to "focus" on a specific corder of my sprite and judge whether or not it will collide if it procedes in a certain direction...
Here is what I have tried...
I thought this would work, but when my character is halfway down below the surface of a neighboring tile (on the map) they still move left and right through the tile......
BTW... my player sprite is 30x30
Thanks for any help you can give...
Squirrelly1
I have a player sprite that i'm using on a 2D side scrolling map (right now it's just a smiley face, but that's not the point )
I need to check the sprites CORNERS in order to see if it will collide with my map at any point around the sprite...
I thought I could do this by using the SprSetXCentre and SprSetYCentre functions, but I guess I was wrong...
What I need to do is be able to "focus" on a specific corder of my sprite and judge whether or not it will collide if it procedes in a certain direction...
Here is what I have tried...
'Get the XCoord and YCoord for collision detection
bindsprite(player.sprite) 'use the player's sprite
LeftInt = (SprLeft() / 32)
RightInt = (SprRight() / 32)
'Left Hand side Top and Bottom Corner...
SprSetXCentre(0):SprSetYCentre(0)
If tiles (SprX()/32)(SprY()/32) <> 7 Then
LCol = True
Else
LCol = False
EndIf
'If That didn't flag it then change the center to the bottom and test
If Not LCol Then
SprSetXCentre(0):SprSetYCentre(1)
if tiles (SprX()/32)(SprY()/32) <> 7 Then
LCol = True
Else
LCol = False
EndIf
EndIf
'Right Hand Side Top and Bottom Corner
SprSetXCentre(1):SprSetYCentre(0)
If tiles ((SprX()/32)+1)(SprY()/32) <> 7 Then
RCol = True
Else
RCol = False
EndIf
'If That didn't flag it then change the center to the bottom and test
If Not RCol Then
SprSetXCentre(1):SprSetYCentre(1)
If tiles ((SprX()/32)+1)(SprY()/32) <> 7 Then
RCol = True
Else
RCol = False
EndIf
EndIf
SprSetXCentre(0):SprSetYCentre(0)
I thought this would work, but when my character is halfway down below the surface of a neighboring tile (on the map) they still move left and right through the tile......
BTW... my player sprite is 30x30
Thanks for any help you can give...
Squirrelly1
TEXT
TEXT