Does GET TOUCH N AS X,Y only work with screen coordinates?
I was trying to get it to work with a sprites coordinates, in a SPRITE BEGIN, SPRITE END.
GRAPHICS
GRAPHICS CLEAR 1,1,1
N$="mysprite"
SPRITE N$ BEGIN 200,100
GRAPHICS CLEAR 0,1,0
SPRITE END
SPRITE "mysprite" AT 800,400
SPRITE "mysprite" SHOW
SPRITE "mysprite" BEGIN
LOOP:
GET TOUCH 0 AS x,y
IF y > 0 AND y < 50 THEN
GRAPHICS CLEAR 1,0,0
END IF
GO TO LOOP
SPRITE END
Get touch n as x,y
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Get touch n as x,y
Yes, GET TOUCH works in main graphics view coordinates.
Re: Get touch n as x,y
Cheers, thanks
Coordinates within the sprite
Hi again
SPRITE_HIT (N$, X,Y) detects if the touch from GET TOUCH N AS X,Y is on the sprite.
There seems to no GET command for the coordinates on the sprite so I guess I can use subtraction with GET SPRITE N$ POS X,Y. Or I could put a small identical coloured sprite beside the other one.
SPRITE_HIT (N$, X,Y) detects if the touch from GET TOUCH N AS X,Y is on the sprite.
There seems to no GET command for the coordinates on the sprite so I guess I can use subtraction with GET SPRITE N$ POS X,Y. Or I could put a small identical coloured sprite beside the other one.