Setting an angle around an imagepoint.

0 favourites
  • 2 posts
From the Asset Store
3D Car Pack 1
$2.99 USD
3D models + Rendered Low-Poly Cars in isometric, top-down, and side angles.
  • Is it possible to set an angle of a sprite around an image point?

    I have a 32x32 sprite with the origin top-left as I want to snap it to a 32x32 grid, and at the start of the game it can be rotated to one of these angles; 0,90,180,270.

    I know how to rotate "choose(....)" but it rotates it around the origin at the top left, I want it to rotate around its imagepoint which is in the center. Is there a way?

    Edit: spelling

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You could either leave the origin in the centre and have it snap to a 16x16 grid

    or set it's position alongside rotating it like:

    set angle to 90

    set x to self.x+self.width

    but of course a different position would be needed for each angle.

    If you need them to rotate more than once, so it works regardless of their current angle, you could have an imagepoint in each corner.

    So for rotating 90 degrees:

    set position to self.imagepoint(TopRight)

    set angle to self.angle+90

    and for rotating 180 degrees

    set position to self.imagepoint(BottomRight)

    set angle to self.angle+180

    etc

    ps: this should have been posted in the 'how do i' forum

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