LoginLogin

Touch screen interaction

Root / General / [.]

matthew3737Created:
How do I make it so that I can use the touch screen and when I touch the screen in a different spots it will animate different sprites while holding the screen in that spot?

How do I make it so that I can use the touch screen and when I touch the screen in a different spots it will animate different sprites while holding the screen in that spot?
please explain better also linking this thread here also this belongs in programming questions, not general

How do I make it so that I can use the touch screen and when I touch the screen in a different spots it will animate different sprites while holding the screen in that spot?
please explain better also linking this thread here also this belongs in programming questions, not general
what I meant is if I touch the screen in 1 spot how do I make it play a few big sprite sheet images in a a loop (like a gif) until I stop touching it there and can I make it do different ones when I touch the screen in a different spot? (Im trying to make a program basically like tomodachi life's interaction with the mii's) and i'll post in programming questions next time. im new to SBsource

How do I make it so that I can use the touch screen and when I touch the screen in a different spots it will animate different sprites while holding the screen in that spot?
please explain better also linking this thread here also this belongs in programming questions, not general
what I meant is if I touch the screen in 1 spot how do I make it play a few big sprite sheet images in a a loop (like a gif) until I stop touching it there and can I make it do different ones when I touch the screen in a different spot? (Im trying to make a program basically like tomodachi life's interaction with the mii's) and i'll post in programming questions next time. im new to SBsource
Firstly, the name of SmileBASIC Source is shortened to SBS, not SBsource Secondly, follow the examples for checking where the touch is and check if the time you touch the screen is greater than 1 and use SPDEF to make big sprites.

Alright, so more corrections here, IT DOES NOT MATTER WHAT YOU CALL SBS AND SBsource is just fine
Spoileridk why DSM said that, as there is no *set* way to say it, simply just depends on whether you like shortening down stuff a ton or putting the effort to put a better name
. Alright so for todays how to we will need 3 main things. 1: starting using the touch screen. Making it avaible for use is as simple as putting
STICK OUT TT,SX,SY
and just put that in the loop. 2: making a touch box. Alright so to detect touches in a certain area we use what I like to call "touch boxes". simply put they make a box in which you detect where on the touch screen it is being touched for say buttons or stuff on the touch screen. Ok the following code will make a small box and BEEP when it is touched:
IF TX>50 AND TX<100 THEN 
 IF TY>50 AND TY<100  && TT==0 THEN 
  BEEP 
 ENDIF
ENDIF
That unless It has an error will beep when touched in the area between 50 and 100 X and Y. So for a quick what was done, we simply check if the touch screen was touch in the given area which was set as 50 to 100 on both X and Y, now when making your own you have to make sure of one thing: that the for of the two numbers is always smaller then the 2nd, otherwise it wont work. What I like to do when testing is make a gbox in the same area to show where you will be detecting touches, so to do that its as simple as matching the X and Y on the box:
GBOX 50,50,100,100
AND TADA! you now have a white (or whatever color its set to) box where the touches will be detected. Animation is a bit more complicated so for now I will wait for a response to see if you understand this. And lastly your nice loop which you can do your own but mine normally looks like:
ACLS

WHILE 1
VSYNC
'(CODE HERE)
WEND

Alright, so more corrections here, IT DOES NOT MATTER WHAT YOU CALL SBS AND SBsource is just fine
Spoileridk why DSM said that, as there is no *set* way to say it, simply just depends on whether you like shortening down stuff a ton or putting the effort to put a better name
. Alright so for todays how to we will need 3 main things. 1: starting using the touch screen. Making it avaible for use is as simple as putting
STICK OUT TT,SX,SY
and just put that in the loop. 2: making a touch box. Alright so to detect touches in a certain area we use what I like to call "touch boxes". simply put they make a box in which you detect where on the touch screen it is being touched for say buttons or stuff on the touch screen. Ok the following code will make a small box and BEEP when it is touched:
IF TX>50 AND TX<100 THEN 
 IF TY>50 AND TY<100  && TT==0 THEN 
  BEEP 
 ENDIF
ENDIF
That unless It has an error will beep when touched in the area between 50 and 100 X and Y. So for a quick what was done, we simply check if the touch screen was touch in the given area which was set as 50 to 100 on both X and Y, now when making your own you have to make sure of one thing: that the for of the two numbers is always smaller then the 2nd, otherwise it wont work. What I like to do when testing is make a gbox in the same area to show where you will be detecting touches, so to do that its as simple as matching the X and Y on the box:
GBOX 50,50,100,100
AND TADA! you now have a white (or whatever color its set to) box where the touches will be detected. Animation is a bit more complicated so for now I will wait for a response to see if you understand this. And lastly your nice loop which you can do your own but mine normally looks like:
ACLS

WHILE 1
VSYNC
'(CODE HERE)
WEND
It says "Stick" is being used wrong

Alright, so more corrections here, IT DOES NOT MATTER WHAT YOU CALL SBS AND SBsource is just fine
Spoileridk why DSM said that, as there is no *set* way to say it, simply just depends on whether you like shortening down stuff a ton or putting the effort to put a better name
. Alright so for todays how to we will need 3 main things. 1: starting using the touch screen. Making it avaible for use is as simple as putting
STICK OUT TT,SX,SY
and just put that in the loop. 2: making a touch box. Alright so to detect touches in a certain area we use what I like to call "touch boxes". simply put they make a box in which you detect where on the touch screen it is being touched for say buttons or stuff on the touch screen. Ok the following code will make a small box and BEEP when it is touched:
IF TX>50 AND TX<100 THEN 
 IF TY>50 AND TY<100  && TT==0 THEN 
  BEEP 
 ENDIF
ENDIF
That unless It has an error will beep when touched in the area between 50 and 100 X and Y. So for a quick what was done, we simply check if the touch screen was touch in the given area which was set as 50 to 100 on both X and Y, now when making your own you have to make sure of one thing: that the for of the two numbers is always smaller then the 2nd, otherwise it wont work. What I like to do when testing is make a gbox in the same area to show where you will be detecting touches, so to do that its as simple as matching the X and Y on the box:
GBOX 50,50,100,100
AND TADA! you now have a white (or whatever color its set to) box where the touches will be detected. Animation is a bit more complicated so for now I will wait for a response to see if you understand this. And lastly your nice loop which you can do your own but mine normally looks like:
ACLS

WHILE 1
VSYNC
'(CODE HERE)
WEND
It says "Stick" is being used wrong
Replace STICK with TOUCH

Alright, so more corrections here, IT DOES NOT MATTER WHAT YOU CALL SBS AND SBsource is just fine
Spoileridk why DSM said that, as there is no *set* way to say it, simply just depends on whether you like shortening down stuff a ton or putting the effort to put a better name
. Alright so for todays how to we will need 3 main things. 1: starting using the touch screen. Making it avaible for use is as simple as putting
STICK OUT TT,SX,SY
and just put that in the loop. 2: making a touch box. Alright so to detect touches in a certain area we use what I like to call "touch boxes". simply put they make a box in which you detect where on the touch screen it is being touched for say buttons or stuff on the touch screen. Ok the following code will make a small box and BEEP when it is touched:
IF TX>50 AND TX<100 THEN 
 IF TY>50 AND TY<100  && TT==0 THEN 
  BEEP 
 ENDIF
ENDIF
That unless It has an error will beep when touched in the area between 50 and 100 X and Y. So for a quick what was done, we simply check if the touch screen was touch in the given area which was set as 50 to 100 on both X and Y, now when making your own you have to make sure of one thing: that the for of the two numbers is always smaller then the 2nd, otherwise it wont work. What I like to do when testing is make a gbox in the same area to show where you will be detecting touches, so to do that its as simple as matching the X and Y on the box:
GBOX 50,50,100,100
AND TADA! you now have a white (or whatever color its set to) box where the touches will be detected. Animation is a bit more complicated so for now I will wait for a response to see if you understand this. And lastly your nice loop which you can do your own but mine normally looks like:
ACLS

WHILE 1
VSYNC
'(CODE HERE)
WEND
It says "Stick" is being used wrong
Replace STICK with TOUCH
Eyy sorry, minor mistake :| . (I'm used to helping on stick commands a lot sorry lol) But yeah TOUCH OUT.

Eyy sorry, minor mistake :| . (I'm used to helping on stick commands a lot sorry lol) But yeah TOUCH OUT.
Ok I fixed it and sorry for the very late reply