Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Rotating a group sprite about its center point — Gideros Forum

Rotating a group sprite about its center point

augustino_fpaugustino_fp Member
edited October 2017 in General questions
Hi everyone,

I've been running into some issues when attempting to rotate a group sprite (and hence all its children) about the group sprite's defined center point. Essentially what I want to accomplish is rotate all children around the group sprites anchorpoint by calling Group:setRotation. However, whenever I do this, the group sprite seems to rotate around the upper left anchor point (or something like that) rather than the center point. I have attached a quick example code to show essentially what my code resembles. Would anyone happen to know how to accomplish this? Thanks!
lua
lua
group_sprite_example.lua
690B

Comments

  • Can you post a copy of the entire project (inc gfx)? - that makes it easier for someone to try it and get back to you as to what has gone wrong.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • hgy29hgy29 Maintainer
    Accepted Answer
    Gideros keeps the anchor point as an absolute value internally, so your initial setAnchorPoint is converted to the center of the group at the time the function is called. And since it is empty it will be 0,0. Either move it to after you have added content to your group, or use setAnchorPosition instead and give him the expected absolute anchor position.

    Likes: SinisterSoft

    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.