Homade Image Points

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

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

  • Try Construct 3

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

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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)