Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
Graphics
»
Rotation
Print
Pages: [
1
]
Author
Topic: Rotation (Read 1317 times)
0 Members and 1 Guest are viewing this topic.
mauz013
Newbie
Posts: 1
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
Logged
knackname
Newbie
Posts: 2
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
Logged
Print
Pages: [
1
]
SFML community forums
»
Help
»
Graphics
»
Rotation