Get x,y of image points

Get help using Construct 2

Post » Fri Nov 22, 2013 1:10 am

Is it possible to get the x,y coordinates of an instanced object's image point(s) on the layout?

What I'm trying to do : In the game you can place rectangular objects (construction) and I want to save the coordinates of 4 positions within each newly placed object to be referenced later by storing them in an array.


I thought about having a toggle for when the object is first placed, which spawns a new placeholder object on each image point and saving their coordinates before destroying them but it seemed inefficient.

Hence the question, is there a way to get the coordinates of instanced image points?

My apologies for confusion in the explanation, will clarify if neededCentra2013-11-22 01:15:43
B
10
S
2
Posts: 80
Reputation: 995

Post » Fri Nov 22, 2013 1:30 am

Yes of course

Sprite.ImagePointX(1)
Sprite.ImagePointY(1)

gives you the image point 1 location of sprite.
B
87
S
44
G
16
Posts: 1,002
Reputation: 17,932

Post » Fri Nov 22, 2013 1:30 am

sprite.imagepointx(1) and sprite.imagepointy(1)
1 being the index of the image point, so sprite.imagepointx(0) will give back sprite.x
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786

Post » Fri Nov 22, 2013 1:48 am

thanks guys! Now to figure this mess out..
B
10
S
2
Posts: 80
Reputation: 995

Post » Fri Nov 22, 2013 2:00 am

Or by name:
sprite.imagepointy("thisIsTheNAMEOfTheFirstImagePointIMade")
sprite.imagepointx("thisIsTheNAMEOfTheSecondImagePointIMade")
Image ImageImage
B
169
S
50
G
169
Posts: 8,288
Reputation: 108,220


Return to How do I....?

Who is online

Users browsing this forum: blackhornet, lordsas, mekonbekon and 70 guests