Andy2080 2018-11-12 19:22
So I’m making a small game where you play as a grey cube and have to move it to a white cube, and when you do that it simply prints “you win”. Any methods on how to check for sprite collisions?
S3B4 2018-11-13 00:27
It’s pretty easy, =SPRITE HIT let’s you check if sprites are colliding with each other.
Remember that the []bracets mean optional parameters.
So if the grea cube was sprite 0 and the white cube was sprite 1 then it would go like this:
IF SPRITE HIT(0,1) THEN what you wan it to do
^you only have to put the 1 if there is more than 2 sprites to avoid it
from detecting other sprites.
was8bit 2018-11-13 05:59
If you have lots of sprites that may hit your one Sprite (say you have one bullet and 10 enemies or targets) use
REM check if Sprite 0 has hit any other Sprite
IF SPRITE HIT(0) THEN
ITHIT = HIT
REM ITHIT is now the number of the Sprite that was hit
END IF
This allows you to now remove the targets awards points, or acquire inventory, whatever :)
Andy2080 2018-11-13 19:00
Thanks it really helped!
Andy2080 2018-11-13 19:01 (Edited)
was8bit 2018-11-13 23:15
:)