SPCOL
Before using any of these commands, you must enable collision detection using
SPCOL.
SPCOL ID
If you want collision detection to work on
SPSCALEd sprites, you must do
SPCOL ID,TRUE 'BEFORE using SPSCALE
You can also set a collision mask:
SPCOL ID,TRUE,Mask
Sprites will only collide if their masks have some of the same bits set.
&B100 will collide with &B111 but not &B001.
SPHITSP
SPHITSP checks for collision between sprites.
Check collision between one sprite and any other sprite:
CollisionID = SPHITSP( ID )
Check collision between two specific sprites:
CollisionID = SPHITSP( ID1, ID2 )
Check collision between one sprite and a range of other sprites:
CollisionID = SPHITSP( ID, LowID, HighID )
SPHITRC
SPHITRC checks if a sprite is touching a rectangular area.
CollisionID=SPHITRC(X,Y,Width,Height)
CollisionID=SPHITRC(ID ,X,Y,Width,Height)
CollisionID=SPHITRC(LowID,HighID ,X,Y,Width,Height)
You can also specify the mask and SPCOLVEC information for the rectangle:
CollisionID=SPHITRC([...,] X,Y,Width,Height,Mask[,VX,VY])
SPHITINFO
You can use SPHITINFO to get more information about the last collision.
SPHITINFO OUT Time[,X1,Y1[,VX1,VY1],X2,Y2[,VX2,VY2]]
Time is a real number between 0 and 1 and I have no idea what it does
After calling SPHITSP/RC normally, you can call SPHITSP() or SPHITRC() again with no arguments.
This will give you information about other collisions (if there are any) or just return -1.
SPCOLVEC
it's pretty cool