mob
bound_x = 9
bound_y = 1
bound_height = 16
bound_width = 16
step_size = 16
Problem description:
Hey guys~
I'm having a bit of an issue here, I'll explain what I think is going on.
A normal tile is 32x32, and that's the default step_size. I'm setting it to 16, which is half of the default. This allows, essentially, 2 mobs at least to be on one tile (and since the bound width and height are set to 16, even 4 on one tile I believe).
Now, the mobs start centered on the tile. One step in any direction would put them half on one tile, half on another.
Yet, when you do things like walk into a wall, or another mob for that matter.. you get knocked off center, approximately 8px I believe, off center.
This means you're on literally half a tile at a time. That'd be ok, but the switching around seems buggy when moving.
I read up on Move() a bit, and it says a slide is when you can't complete the full step_size, so you just kinda.. complete what's possible.
Is it possible to simply negate sliding?
The first thing you'd want to check is if NewLoc is not directly next to the player. If this is the case movement should occur normally, as this is considered a jump.
You will then want to store the current location of the atom + the step_x/step_y variables in a variable for later use.
If not then the movement is considered a slide. You'll then want to check if the player is able to get to that tile. You could do this by performing . = ..().
If the dot variable (.) is not equal to step_size you would move the player back to the old location and reset the step_x/step_y variables to their old values. Then you would return 0 to indicate that the movement has been blocked.
Otherwise, you allow movement to pass through.
AFAIK this would do what you want: if a player can't move the full step_size it would prevent movement. Note that if you use my exact method it would still call procs like Entered and Crossed even if the movement failed.
You may want to take a look at this post which has a soft-coded version of the movement system. Note that this was designed before the introduction of pixel-based movement.