Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Rotation  (Read 1316 times)

0 Members and 1 Guest are viewing this topic.

mauz013

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
Rotation
« on: September 04, 2020, 01:29:38 am »
Hey guys so
I am creating this PAC man game
when I rotate the sprite it also moves the sprite by one position ie:

if I rotate it 270 deg
it rotates and moves right
if I rotate it 90 deg
it rotates and moves left

knackname

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: Rotation
« Reply #1 on: September 04, 2020, 03:51:22 am »
The sprite rotates relative to it's origin which by default is the top left: (0,0). You will need to set the origin to the center if you want it to rotate around the center. Something like sprite_name.setOrigin(width/2. height/2) should do the trick

 

anything