1
\$\begingroup\$

Is there a way to set the pivot point for rotating a sprite? The default option seems to be arbitrarily chosen point on the sprite or the mid point.

var arrow = createSprite(200, 200);
arrow.setAnimation("arrow");
//set center of sprite to a point in the coordinate system or based on description like
//botton end, top end, mid point, etc.

arrow.rotate = 45;
drawSprite();

I'm using the code.org GameLab infrastructure to execute this code. https://code.org/educate/gamelab

\$\endgroup\$
2
  • \$\begingroup\$ Does arrow have an origin? If so, you should be able to set the center position from there. \$\endgroup\$
    – Steven
    Commented Nov 3, 2023 at 12:29
  • \$\begingroup\$ There is a default origin, but I want to change it to a different point within the sprite. \$\endgroup\$
    – Naveen
    Commented Dec 15, 2023 at 2:53

0

You must log in to answer this question.

Browse other questions tagged .