0 Favourites

This forum is currently in read-only mode.
• 5 posts
• 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.

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• 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

• 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.

• Thanks again!

Anglelerp along with infinite image points will make for some great effects.

Question tho.

Does that take into account the sprites dimensions?

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))

• Thanks, works perfect.

On a side note, is Math supposed to be a layout object?

• 5 posts