Player's center Help

can any help me for some reason when i put in Player.CenterX()/Player.CenterY() for my enemy to rotate to look at my player it never looks my way it look to a area away for my player and I don’t know why
(if it helps it for a top downshooter game )

How is your Player’s sprite?
Is it very big and only a few part is colored and place near sides?

I read your post again and you are getting Player’s Centre point wrongly. You need to use Player.CentreX() and Player.CentreY() but instead, you are using Player.X()Centre and Player.Y()Centre

1 Like

Alternatively, it can be also Player.X(“Center”) and Player.Y(“Center”).

1 Like

sorry i am typing it that way. i just accidentally did it wrong but it doesn’t work that way for me

Please take a screenshot showing your actual events, and a screenshot showing your object that you are trying to rotate. We can better assist that way.

In Windows, you can take a screenshot by pressing the windows key + shift + S on your keyboard.

(Please do not post phone camera photos of your monitor)

1 Like

Are you near the Zombie?

GDevelop does Rotation like this.
So, your sprite facing is facing up in 0 degrees and on 90 degrees, it faces to the right and same for all other angles.

1 Like

To clarify, we need the object settings in the object editor, not the scene/preview. Like when you set up the object animations.

do you mean this?

Almos in that screen click EDIT POINTS.

@Muzan is right with the rotation of the sprite. The side that should face the player needs to be adjusted to 0° (to the right) in the frame as shown in the diagram.


Is your image 2048px? if not
Well you ca try moving x,y to 0,0 then try the rotation in events, if that doesn’t work then move point x/y to the center of the image and try rotation event

@Demon1071 - the problem you have is probaly not caused by your player sprite. According to your events the player is probably the round thing with arms (the sprite you posted) . You mentioned that enemy (zombie) is not facing the player properly, so you need to adjust your zombie sprite by default to the right or 0° in your animation frame.

edit: in my edited post I thought the posted sprite is the enemy
edit2: I guess the green one is the enemy/zombie after all.

This is what @Drona means. Edit the image file so it looks like :


oh thank you it now works thanks for the help

1 Like