centerOffsets help

  • 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?

    // Doing it myself works!
    // offset.x = 10;
    // offset.y = 13;

  • administrators

    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 offset to (0,0). Take a look at the implementation of centerOffsets():

  • @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.

  • administrators

    Doesn't sound like you should be modifying offset then, that will modify the position of the hitbox in relation to the graphic. Can't you just adjust x and y accordingly (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!

Log in to reply