Player Starting Position is WRONG

I put my Player at X=578. When you press a key, it is supposed to switch to a different animation.

During Preview of the game, Player starts significantly farther ahead than 578. When I press a button, he instantly goes to 578 and does the new animation.

Here is what I have tried:

  1. deleting an object that may be colliding with Player (didn’t change the issue)
  2. Changing Player’s starting position to where the game apparently wants it to be (just ended up starting even farther ahead than I want it to, slingshotting it back to the new starting position with key press)
  3. Changing the Player’s starting position to farther back (started where I wanted it, but key press made it go too far back)
  4. Changing the hit box of the Player (no effect)
  5. Checking the source code (insists the Player’s position is, indeed, x=578.)

I barely have any code on this thing and I’m already losing my mind. Any ideas?

I’m not quite sure, but I can think of a reason for that to happen.
Is the Player farther head ONLY in the first animation and not in the second animation?
Does the Player go to the intended position ONLY when the second animation is playing, and not when the first one is?

Are the frames of your sprite’s animation the same size?

If the animations are of different sizes - for example, one is 16x16 and the other is 32x32 - the character will do some very weird jumps when the animation changes.
If in the “Note” animation the dimensions are 16x16 and in the “Transform” animation those dimensions change to 32x16 (without changing the height, but changing the width) then it will give the impression of the character being “thrown” to the side when the animation changes.

If it’s not that, then I have absolutely no idea what it could be.

1 Like

If the debugger says the position is correct, then the position is correct :grin:
You mentioned checking the hitbox, but in this case, you should rather check the points.
But I suppose @MayhemCats is right with the sprites not being the same size. If not, screenshots might prove helpful.

1 Like

Yay! You were right about the size of the animation - it seems like such a simple thing I should have caught. I went in and fixed every animation and the problem is solved. Thanks so much!!

2 Likes