Set Object1.ImagePoint to Object2.ImagePoint

Get help using Construct 2

Post » Wed Feb 13, 2013 10:34 pm

A refined question to my original post:
Is it possible individually place a sprite according multiple image points on the same sprite? Essentially redrawing/resizing/reshaping the sprite in relation to ANOTHER sprite's image points??

Here is an updated .capx of what I have now...
https://www.sugarsync.com/pf/D6025908_4317202_6510878Rhindon2013-02-13 22:41:27
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
112
S
20
G
8
Posts: 741
Reputation: 13,636

Post » Wed Feb 13, 2013 11:03 pm

sprite1.X is the absolute X coordinate of sprite1's origin point. imagepointX similarly gives the absolute X coordinate of sprite1's image point relative to Construct's coordinate system (the top left corner). So subtracting the two gives us the difference or relative position of sprite1's imagepoint to sprite1's origin point. This is important because with the Set Position action we are forced to figure out where the sprite's *origin* has to be in order for it's image point to be in the correct place.

For example, if we have a sprite with origin (1,2) and imagepointXY (3,2) (which means relative difference of (2,0) which you want to move to sprite2's point (5,6) this is how the expression math works out:
5 - (3 - 1) = 5 - 2 = 3
6 - (2 - 2) = 6 - 0 = 6
Notice how in the parentheses we got the relative diffence between sprite1's origin and it's image point. The object's new origin point is (3,6), placing the image point (2,0) from that at (5,6) absolutely.

If it helps my #1 method for figuring out how exactly what some number means or what something does is to make a quick blank project with a sprite or two and a text object set to any/all values I'm interested in and just muck around until I understand what's going on.

In answer to your second question, yes it is possible but the math is more work than what I just did. You'll have to use more expression variables like sprite.Height and sprite.Width and resize things. If I have time I might be able to look at your capx later and advise you further but I don't know if I can.Phyvo2013-02-13 23:08:46
B
6
S
1
Posts: 40
Reputation: 917

Post » Fri Mar 22, 2013 9:45 pm

Hello, I was searching how to do something quite similar to this.

(Here's my post http://www.scirra.com/FORUM/topic65335_post400758.html#400758)

If you ever figure out how, let me know!Yandraker2013-03-22 21:46:18
B
3
Posts: 11
Reputation: 372

Post » Sat Mar 23, 2013 7:54 am

Looks like @buddy40 has a better solution than anything I've come up with. C2 doesn't support what I had in mind...at least not yet. What I was trying to do requires the ability to warp shapes (not supported) by way of keeping image points of the same sprite attached to independently moving coordinates (also not supported).
I'm seeking Narnia. Who wants to come with me! Aslan is on the move!
B
112
S
20
G
8
Posts: 741
Reputation: 13,636

Previous

Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, MChiz, Radulepy and 0 guests