LoginLogin

Touchscreen tx,ty reseting

Root / Programming Questions / [.]

thatguyCreated:
How can I set tx and ty for example to 0. Because now everytime I start my program it starts out on the last touches spot before ending the program.

I'm not sure what you exactly mean but this may help
ACLS
WHILE 1
DISPLAY 1
TOUCH OUT TX,TY,T
LOCATE 0,1 ?TX
LOCATE 0,2 ?TY
WEND

The problem is if I for example touch the bottom right corner and restart the game the coordinates stil are in the bottom right corner but thanks to your code you reminded me to place a if statement for when the touchscreen is not touched so thanks the problem is solved.

How can i make a touch button on the touchscreen?

How can i make a touch button on the touchscreen?
WHILE 1
 TOUCH OUT T,X,Y
 IF T>0 THEN
  IF X>60 AND X<120 AND Y>60 AND Y<120 THEN
   GFILL 60,60,120,120
  ENDIF
 ELSE
  GCLS
  GBOX 60,60,120,120
 ENDIF
 WAIT
WEND

thanks MZ952

How can i make a touch button on the touchscreen?
WHILE 1
 TOUCH OUT T,X,Y
 IF T>0 THEN
  IF X>60 AND X<120 AND Y>60 AND Y<120 THEN
   GFILL 60,60,120,120
  ENDIF
 ELSE
  GCLS
  GBOX 60,60,120,120
 ENDIF
 WAIT
WEND
and how have you this numbers 60,120 ?

How can i make a touch button on the touchscreen?
WHILE 1
 TOUCH OUT T,X,Y
 IF T>0 THEN
  IF X>60 AND X<120 AND Y>60 AND Y<120 THEN
   GFILL 60,60,120,120
  ENDIF
 ELSE
  GCLS
  GBOX 60,60,120,120
 ENDIF
 WAIT
WEND
and how have you this numbers 60,120 ?
Try this and you'll see the coordinates
ACLS
XSCREEN 2
WHILE 1
DISPLAY 1
?X
LOCATE 0,1 ?Y
 TOUCH OUT T,X,Y
 IF T>0 THEN
  IF X>60 AND X<120 AND Y>60 AND Y<120 THEN
   GFILL 60,60,120,120
  ENDIF
 ELSE
  GCLS
  GBOX 60,60,120,120
 ENDIF
 WAIT
WEND
btw MZ952 just changed your code a lil' bit so he's able to see the coordinates

There is no way to change the TX and TY values of TOUCH OUT, other than touching the touchscreen.