How do I convert touch co-ordinates to world co-ordinates.

Get help using Construct 2

Post » Wed Jan 07, 2015 2:49 pm

Basically I want to know what the equivalent touch x and y are in the world position.

Any ideas?
ImageImageImageImageImage
B
19
S
5
G
1
Posts: 614
Reputation: 2,542

Post » Wed Jan 07, 2015 2:51 pm

Not sure what you're looking for, but have you noticed that the Touch object has both X and Y and AbsoluteX and AbsoluteY? Maybes that's what you need...
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
16
S
4
G
1
Posts: 428
Reputation: 2,337

Post » Wed Jan 07, 2015 2:59 pm

So it looks like AbsoluteX is in canvas co-ordinates and X is in layout co-ordinates. So I must be doing something else wrong elsewhere. Thanks.
ImageImageImageImageImage
B
19
S
5
G
1
Posts: 614
Reputation: 2,542

Post » Wed Jan 07, 2015 3:22 pm

Yes they are. What exactly are you trying to do?
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
16
S
4
G
1
Posts: 428
Reputation: 2,337

Post » Wed Jan 07, 2015 7:27 pm

I was trying to do a swipe screen action to scroll a screen. So I've used an invisible sprite with the scroll to behavior and set its position to the touch position. Which worked but was far too fast. So I was trying to slow it down by making it move to the touch position by giving it the 8 direction behavior and setting a velocity by using the touch co-ordinates. Which went down the screen well enough, but not up. I'm sure its just a matter of fiddling.
ImageImageImageImageImage
B
19
S
5
G
1
Posts: 614
Reputation: 2,542

Post » Wed Jan 07, 2015 7:44 pm

So encase someone is interested I did the following to get it working.

Image
ImageImageImageImageImage
B
19
S
5
G
1
Posts: 614
Reputation: 2,542

Post » Fri Jan 09, 2015 2:41 pm

You can always use lerp(currentX, Touch.X, 0.1) to smooth the swipes...
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
16
S
4
G
1
Posts: 428
Reputation: 2,337


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 15 guests