|
Post by davidzx on Jul 3, 2020 22:51:12 GMT
Hi,
Is there an ASM way to get the collision side between two sprites? I mean, if sprite1 is collisioning with sprite2 by right, left, up or down. Comparing x, y variables beetween the two sprites is a mess.
Thanks
|
|
|
Post by Packobilly on Jul 4, 2020 7:55:59 GMT
Hi! Some such asm code would really be interesting. I really don't know if there is. For now, I would do as you say.
In sprite one LET I Y
In sprite two
IF HIT (sprite one) IF I > X (...) ENDIF ELSE (...) ENDIF
Cheers, fellow!!
|
|
|
Post by davidzx on Jul 4, 2020 10:43:15 GMT
Hola Paco, thanks for your reply
I'm using x, y coordenates but I'm having issues when sprites collision corner to corner. Because sprite moves every two pixels it's not clear to me which side of the corner has impacted with the other sprite
|
|
|
Post by oss003 on Jul 9, 2020 8:47:36 GMT
There is .... however you do have to set the DIRECTION variable for SPRITE2. If you want the collision side of SPRITE1 which collides with SPRITE2
EVENT SPRITETYPE1 ... IF COLLISION 2 OTHER LET I DIRECTION ENDSPRITE IF I = LEFT ; Collision side right ENDIF IF I = RIGHT ; Collision side left ENDIF IF I = UP ; Collision side down ENDIF IF I = DOWN ; Collision side up ENDIF ENDIF ...
|
|