SP to SP collision
Root / Programming Questions / [.]
ChaseCZCreated:
This is kind of a confusing question. Do you mean that you need to check if collision happens on a specific side of the sprite?
Hmm... that could be difficult. If you are only checking for one direction you could set the point of origin slightly below the sprite, but this may cause issues with rotating, scaling, BG collision etc.
SPSET 0,496:SPHOME 0,8,16This can also be done by redefining the sprite:
SPDEF 496,U,V,16,16,8,16Another way you could do this is set transparent sprites around the sides of the main sprite and check their collision.
X=200:Y=150 SPSET 0,496:SPOFS 0,X,Y:SPHOME 0,8,8 FOR I=1 TO 4 SPSET I,0:SPCOLOR I,RGB(0,0,0,0)'You may be able to use SPHIDE instead, but I'm not sure if collision happens when the sprite is hidden. SPCOL I:SPLINK I,0 NEXT SPOFS 1,X,Y-16:SPOFS 2,X+16,Y:SPOFS 3,X,Y+16:SPOFS 4,X-16,YI am not too confident in my code because I am away from my 3DS, but perhaps someone else will verify or provide a better procedure.