トピック
Brad GamerZim

sprite collision

Ok so I can do some fun and easy stuff, but how do i get sprite collision to work? the sample is just really vauge on how it works.
0そうだね
プレイ済み
返信[1]
親投稿
C. Norris 06495a
When you set a sprite also use spcol. This command sets a hit box to a sprite, use the help button for more info. To detect a collision use sphitsp, again, help button for more information. If you have more questions, ask away.
1そうだね
プレイ済み
返信[2]
親投稿
Brad GamerZim
thanks man, you rock
0そうだね
プレイ済み
返信[3]
親投稿
Brad GamerZim
wanted to make a small test, if player sprite touches npc sprite, it will beep, obviosly code is wrong, any tips?
0そうだね
プレイ済み
返信[4]
親投稿
C. Norris 06495a
You also need to set a hitbox for the npc
0そうだね
プレイ済み
返信[5]
親投稿
Brad GamerZim
alright thanks, is am not sure if sphitsp is used right and how do i make the sprites solid to each other
0そうだね
プレイ済み
返信[6]
親投稿
C. Norris 06495a
Try the ranged sphitsp, the one with three numbers. To make sprites solid make a condition instead of beep. If b and 1 and move==true.... If sphitsp(0,1,2)>=1 then move=false else move=true
0そうだね
プレイ済み
返信[7]
親投稿
Brad GamerZim
could you please send me a pick of this code in action? you'r a great help man! sorry if i seem dumb at this, i just have no coding experience so I don't have a understanding of complex coding (sprites and sprite actions)
0そうだね
プレイ済み
返信[8]
親投稿
Brad GamerZim
alright, sp phases threw but beep activates when both sprites hit boxs meet. its a start
1そうだね
プレイ済み
返信[9]
親投稿
C. Norris 06495a
I have an old engine that i made, I'll see if I can send the code
0そうだね
プレイ済み
返信[10]
親投稿
C. Norris 06495a
The key is EED3K39J It isn't commented but it shows a bit of a broken sp collision, as well as how to use it
1そうだね
プレイ済み
返信[11]
親投稿
Brad GamerZim
man your awesome, this is the most help I'v ever gotten on this
0そうだね
プレイ済み
返信[12]
親投稿
BeefJerkey SuperBeefJerkey
On both sprites, you must first use SPCOL on each one. SPCOL {sprite management number},TRUE Use that on each sprite, then use SPHITSP. IF SPHITSP( {management number of first sprite},{management number if other sprite} )THEN BEEP{number} That can also be used to set a variable.
1そうだね
プレイ済み
返信[13]
親投稿
C. Norris 06495a
Absolutely no problem, one of the reasons I check miiverse is to help people, so don't be afraid to ask questions
2そうだね
プレイ済み
返信[14]
親投稿
Brad GamerZim
two questions about your code, how does the DI==&& do, and why is button commands a gosub vs a straight command in the loop?
0そうだね
プレイ済み
返信[15]
親投稿
C. Norris 06495a
DI stands for the direction that the sprite is facing, && is another way to type AND, and the movements are gosubs because that is how I organize my thoughts.
0そうだね
プレイ済み
返信[16]
親投稿
Brad GamerZim
got ya, just curious. also noticed it helps sprites change without interference with other lines. tried diffrent things on your code to kinda figure things out, also your way is good, its easy for a beginer to figure things out
1そうだね
プレイ済み