プレイ日記
Chickens32 Chickens32
How do I use spcol and collisions. I wanna make,like, interactions by pressing A.
0そうだね
プレイ済み
返信[1]
親投稿
PChicken NerdChicken
SPCOL <sprite num> make sure you do this for all the sprites that you want to detect are touching each other. SPHITSP(<sprite num>,<sprite num>[,<to sprite num>]) this will return a boolean, so use it in an IF statement. the optional third parameter makes it return true if the first sprite is hitting any of the sprites between the second param and the third param.
0そうだね
プレイ済み
返信[2]
親投稿
Chickens32 Chickens32
Why won't it work? (Look in green section)
0そうだね
プレイ済み
返信[3]
親投稿
PChicken NerdChicken
Because you're not giving another sprite ID to the SPHITSP function. Right now, you're asking if sprite id 2 is being hit, and SPHITSP is asking frantically for a specific sprite or sprite range to check collision with sprite 2 for.
0そうだね
プレイ済み
返信[4]
親投稿
Chickens32 Chickens32
Oh! So I need two?
0そうだね
プレイ済み
返信[5]
親投稿
PChicken NerdChicken
Yes, and I also found a problem with your code, if this is your final game structure. The SPHITSP needs to be called inside of the same loop that moves the sprites about, otherwise it will just check once and be done.
0そうだね
プレイ済み
返信[6]
親投稿
Chickens32 Chickens32
OH! O.K. Let me try that!
0そうだね
プレイ済み
返信[7]
親投稿
Chickens32 Chickens32
Um... It still won't work.
0そうだね
プレイ済み
返信[8]
親投稿
Try a simple program, like this: SPCOL(MG1) SPCOL(MG2) HIT=SPHITSP(MG1,MG2) IF HIT THEN IF BUTTON(2) AND- 16 THEN BEEP 7 MG1 and MG2 are Management Numbers, which is the 1st number you put in SPSET (In SPSET 3,4 , 3 is the management number) This all means is if MG1 touches MG2 then allow IF BUTTON(2) AND 16 THEN BEEP 7. If you have any questions, i dont mind answering!
0そうだね
プレイ済み
返信[9]
親投稿
Chickens32 Chickens32
When I change what the sprite looks like or where it is, it doesn't work.
0そうだね
プレイ済み