トピック
MSWS coolestkid123

How to test for sprite collision

Someone please explain to me how to detect 2 sprites touching! If you could use MAN and DRG as the two sprite def. numbers then thanks!
1そうだね
プレイ済み
返信[1]
親投稿
nate NJR1432
Heres a little sprite collision code. SPSET 0,0,0 SPSET 1,16,0 SPHOME 1,-50,-100 SPCOL 0 SPCOL 1 @BUMP SPOFS 0,X,Y,-10 B=BUTTON IF B AND 1 THEN GOSUB @UP IF B AND 2 THEN GOSUB @DOWN IF B AND 4 THEN GOSUB @LEFT IF B AND 8 THEN GOSUB @RIGHT GOTO @BUMP continued...
1そうだね
プレイ済み
返信[2]
親投稿
nate NJR1432
@UP Y=Y-1 VSYNC 1 IF SPHITSP(1,0) THEN ACLS RETURN @DOWN Y=Y+1 VSYNC 1 IF SPHITSP(1,0) THEN ACLS RETURN @LEFT X=X-1 VSYNC 1 IF SPHITSP(1,0) THEN ACLS RETURN continued...
1そうだね
プレイ済み
返信[3]
親投稿
nate NJR1432
@RIGHT X=X+1 VSYNC 1 IF SPHITSP(1,0) THEN ACLS RETURN Hope i helped!
1そうだね
プレイ済み
返信[4]
親投稿
MSWS coolestkid123
@nate Thanks for the code, i'll try it out as soon as I can!
1そうだね
プレイ済み
返信[5]
親投稿
MSWS coolestkid123
It works! I wasn't doing spcol for both sprites, just 1! Thanks @nate. I also shortened the code a little.
1そうだね
プレイ済み
返信[6]
親投稿
nate NJR1432
Your welcome :)
0そうだね
プレイ済み