Homade Image Points

For questions about using Classic.

Post » Tue Apr 05, 2011 10:48 pm

Is there a specific formula to set up your own image point?
I've been looking at cos(sprite.angle)*distance from hotspot + sprite.x, and sin(sprite.angle)* distance from hotspot + sprite.y, and had some decent results, but its limiting as the distance from the hotspot has to be the same for both x, and y.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Tue Apr 05, 2011 11:14 pm

yeah, s has them done for you already as expressions
under the expression list
"get rotated x/y from offsets does this"
S.xoffrot(origin x, origin angle, x offset, y offset)
S.yoffrot(origin y, origin angle, x offset, y offset)
origin x or y would be your hotspot, or sprite location
angle is the sprites angle

x and y offset are your imagepoint x and y
and it returns the x location of where the imagepoint would be

The "get x offset" and "get y offset" expressions do the reverse
if you have a thing that you want to be the new imagepoint, but your sprite is already rotated, so you need to retrieve these rotated x and y offsets, you do that with those expressions

maybe I'll add those to the math plugin next, since it'd be a simple copy/paste job
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Tue Apr 05, 2011 11:48 pm

Thanks again!
Anglelerp along with infinite image points will make for some great effects.
Question tho.
Does that take into account the sprites dimensions?

Edit:
Ok nevermind, I can just add height width into the offsets.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Tue Apr 05, 2011 11:58 pm

[quote="newt":1v6sdj6c]Thanks again!
Anglelerp along with infinite image points will make for some great effects.
Question tho.
Does that take into account the sprites dimensions?[/quote:1v6sdj6c]
no, it does not. just the numbers you put in there
if you want it to do that you would.....
multiply the imagepoint x and y you input into the expressions (not the result)
by
(sprite.width/sprite.originalwidth)

like:
S.xoffrot(origin x, origin angle, x offset * (sprite.width/sprite.originalwidth), y offset * (sprite.height/sprite.originalheight))
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Wed Apr 06, 2011 1:25 am

Thanks, works perfect.
On a side note, is Math supposed to be a layout object?
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest