ID:836158
Jun 26 2012, 9:59 am
|
|
Why is the gliding speed for diagonal movement always slower than the gliding speed for the up, down, left, and right movement? I started noticing this when I was trying to set up custom glide sizes for all the enemies in my game to make their movement have no skips in it. Even after I manually set their glide sizes their glide still takes longer to complete when they move diagonally, which causes jumpy movement only in those directions. I was wondering if anybody else has acknowledged this issue and if it will be fixed?
| |
#1 Jun 26 2012, 10:13 am
|
|
It's likely because you are moving (for example) east and north. It has to take 2 movements into account and therefore takes twice as long as a cardinal movement.
| |
#2 Jun 26 2012, 12:12 pm
|
|
I'd like this fixed. Stepping diagonally is one move and the glide should take the same amount of time as a cardinal step, regardless of the set glide size.
That is, I've had to manually account for moving diagonally. It should do it automatically. Of course, I've only used pixel movement lately so it doesn't apply to me anymore. But it's still a problem. | |
#3 Jun 26 2012, 12:49 pm
|
|
It's funny you would say that. I had to actually slow down the movement on the Up-Down axis (which is diagonal), in my isometric project, because the movement was too fast in comparison to Left-Right, although I think it may be caused by the rhombus shape of the tiles. It had a lot to do with the fact that depth was relative to the tiles, so you should always pass the same number of tiles in the same amount of time, regardless of direction. That's just how isometric maps appear.
Also, I didn't really want to say North-South axis here because it would be extremely confusing to you. The compass of directions already gets rotated automatically when using an isometric map, but for my purposes, I had to "renormalize" it, so that the diagonals are the primary "cardinal" directions. | |
#4 Jun 26 2012, 1:07 pm
|
|
If you look at the distance as a continuous unit instead of discrete pixels, it kinda makes sense. If your icon_size is 32 pixels, then moving in a cardinal direction moves a distance of 32 units. However, to move in a diagonal direction, it has to cover a distance of ~45.2548 units. Maybe they intentionally took this into account, or maybe it's just a bug.
| |
#5 Jun 26 2012, 1:28 pm
|
|
It's hard to set glide_size in a way that will accommodate diagonal movements, because it doesn't take decimal values (not the only thing that should).
| |
#6 Jun 26 2012, 1:51 pm
|
|
Diagonal gliding uses the Euclidean distance, so if glide_size=4 then a diagonal glide is rounded to 3,3.
| |
#7 Jun 26 2012, 2:05 pm
|
|
Back when I used gliding movement, I tried finding an equation that factored in move_delay and tile size. It was pretty simple, gliding from one tile to the next should always take move_delay ticks, so if you held down a movement key, you'd smoothly continue in a straight line at a constant apparent velocity.
This pixel-rounding thing is what causes jumpy gliding movement. If the length of the glide in pixels is off by at least 1 pixel, the glide will either jump or stop and go when moving constantly. | |
