I have a sprite that is 20x26. When I use center offsets it doesn't seem to center. It only works with I set the offsets myself. What am I doing wrong?
loadGraphic(AssetPaths.Player__png); centerOffsets(); // Doing it myself works! // offset.x = 10; // offset.y = 13;
What exactly are you trying to accomplish?
centerOffsets()it usually used if the sprite's graphic has a different size than its hitbox. If
frameWidth == width/
frameHeight == height, it will just set
(0,0). Take a look at the implementation of
@Gama11 I was trying to load the player entity from an ogmo map. But the players x/y position seems to be from the top left of the sprite. I want to make the sprite in the middle of the position.
Doesn't sound like you should be modifying
offsetthen, that will modify the position of the hitbox in relation to the graphic. Can't you just adjust
yaccordingly (assuming this just has to be done once after loading)?
@Gama11 Yea I will just do that. I've got GameMaker in my head to much and thought I could set it some how. Thanks!