Position Saving

Get help using Construct 2

Post » Wed Jan 25, 2012 3:51 pm

Hi,

I want to know if its possible to save on-touch end positions? For example I touch the screen to move an object and on release, I want the object to stay in its current position and when I touch the screen again, I can move it further...
B
5
S
1
G
1
Posts: 111
Reputation: 1,122

Post » Wed Jan 25, 2012 4:37 pm

Touch position is obtained by the expression Touch.X|Touch.Y
So you can assign those positions to global variables "on touch start" and "on touch end".
You can also store the values in an array.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Wed Jan 25, 2012 4:40 pm

Hi Kyatric,

How would I go about saving touch positions using global variables? or Arrays which I haven't used yet nor no much about...
B
5
S
1
G
1
Posts: 111
Reputation: 1,122

Post » Wed Jan 25, 2012 4:54 pm



With global var.
Each time you will start to touch the sprite, it will save its position to currX and currY.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Wed Jan 25, 2012 4:56 pm

Brilliant!

Your a STAR!
B
5
S
1
G
1
Posts: 111
Reputation: 1,122

Post » Wed Jan 25, 2012 5:03 pm

Could I have a look at the cap.x file please! :)

Cant seem to get it to work!2Bdigital2012-01-25 17:09:11
B
5
S
1
G
1
Posts: 111
Reputation: 1,122

Post » Wed Jan 25, 2012 5:14 pm

New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Wed Jan 25, 2012 5:16 pm

Doesn't seem to work at all on the ipad 1st gen!
B
5
S
1
G
1
Posts: 111
Reputation: 1,122

Post » Thu Jan 26, 2012 10:22 am

So I've been playing around with the capx file and this is what I have so far:

SaveTouchPosition

The sprite moves and saves to position as far as I can tell but when I touch it again, it doesn't move... Also the sprite seems to be in the top left corner and I'm not sure why?     

Needing assistance!
B
5
S
1
G
1
Posts: 111
Reputation: 1,122

Post » Thu Jan 26, 2012 12:26 pm

ok... I was wondering for some day now... Don't you just want a basic drag&drop? o.o
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Next

Return to How do I....?

Who is online

Users browsing this forum: DemantDigitalArt, Lancifer and 26 guests