トピック
Clayton DarkClay88

Touching a sprite

How do you make it so when you touch a sprite, it does something.
6そうだね
プレイ済み
返信[1]
親投稿
Hanzo rzsense
ACLS:XSCREEN 2:DISPLAY 1:SPSET 0,0:SPHOME 0,8,8:SPCOL 0 X=160:Y=120:SPOFS 0,X,Y ?"TOUCH A STRAWBERRY" WHILE TRUE VSYNC 1:TOUCH OUT TM,TX,TY:LOCATE 0,1 IF TM>0 && SPHITRC(TX,TY,1,1)==0 THEN ?"TOUCHING" ELSE ?" " ENDIF IF(SPCHK(0)AND #CHKXY)==0 THEN X=RND(304)+8:Y=RND(224)+8:T=RND(40)+20 SPANIM 0,"XY",-T,X,Y,1 ENDIF WEND
1そうだね
未プレイ
返信[2]
親投稿
Clayton DarkClay88
Is it okay if you can explain the touching part, not the moving sprite one?
0そうだね
プレイ済み
返信[3]
親投稿
Hanzo rzsense
If you don't need to move sprite, remove IF - ENDIF above WEND. I've applied "TOUCH OUT TM,TX,TY" to detect coordinates of stylus. While you don't touch bottom screen, TM will keep zero. And I've applied "SPHITRC(TX,TY,1,1)" to detect collision between stylus and sprite. If SPHITRC detects collision, SPHITRC will return the management number of the sprite.
1そうだね
未プレイ
返信[4]
親投稿
Clayton DarkClay88
Oh okay. I getcha. Thanks!
0そうだね
プレイ済み
返信[5]
親投稿
Clayton DarkClay88
What does the LOCATE do in this whole thing?
0そうだね
プレイ済み
返信[6]
親投稿
Hanzo rzsense
LOCATE decides the location to print text string on the screen. If you touch sprite, TOUCHING will be printed on the screen, and if you release sprite, TOUCHING will be erased (overwritten by space). You can figure it out soon if you try removing LOCATE.
1そうだね
未プレイ
返信[7]
親投稿
Clayton DarkClay88
Oh oh oh. Locate was for the text whoops my bad.
0そうだね
プレイ済み
返信[8]
親投稿
Clayton DarkClay88
So, I typed it in and tested it, nothing happened. Do you see what I did wrong?
0そうだね
プレイ済み
返信[9]
親投稿
Clayton DarkClay88
You're suppose to tap the button with the Z's.
0そうだね
プレイ済み
返信[10]
親投稿
Clayton DarkClay88
Sprite code.
0そうだね
プレイ済み
返信[11]
親投稿
Hanzo rzsense
You should do SPCOL to activate collision detection of each sprite.
1そうだね
未プレイ
返信[12]
親投稿
Clayton DarkClay88
Ah okay, that should do it I think.
0そうだね
プレイ済み
返信[13]
親投稿
Clayton DarkClay88
Is there any way to stretch the collision box? Like so if I tap anywhere in the square with the Z's and not just the top left corner, it will do something.
0そうだね
プレイ済み
返信[14]
親投稿
Hanzo rzsense
Set TRUE as second argument of SPCOL like SPCOL 1,TRUE
1そうだね
未プレイ
返信[15]
親投稿
Hanzo rzsense
You should write SPCOL 1,TRUE above SPSCALE 1,3,3
1そうだね
未プレイ
返信[16]
親投稿
Clayton DarkClay88
Awesome! It worked! Thank you so much, Hanzo!
0そうだね
プレイ済み
返信[17]
親投稿
Hanzo rzsense
You're welcome! If you didn't understand anything else, feel free to ask me. I know almost all things except for the things I don't know.
1そうだね
未プレイ
返信[18]
親投稿
Clayton DarkClay88
So you even know how to work with multiplayer or wireless play? :0
0そうだね
プレイ済み
返信[19]
親投稿
Hanzo rzsense
Oh sorry! I'm bad at them(I have no experience), because I have only one 3DS.
0そうだね
未プレイ
返信[20]
親投稿
Clayton DarkClay88
Ah gotcha, is it actually possible to make it online play?
0そうだね
プレイ済み
返信[21]
親投稿
Hanzo rzsense
Unfortunately no. SmileBASIC has no measure to connect to the internet excluding downloading cases.
0そうだね
未プレイ
返信[22]
親投稿
Clayton DarkClay88
Interesting, now it kinda makes me think that they're gonna add that feature in a future update. That would be something.
0そうだね
プレイ済み