247
« on: August 12, 2018, 07:58:59 PM »
let me try to figure out whats goin on.... my movement code looks like this
for each axis (x and y) {
read input for [axis]
if aligned with grid {
set the character's speed along [axis] based on input
}
move [speed] pixels along [axis]
}
the "move" step actually moves one pixel at a time, stopping if either the character hits a wall, or if that pixel-move aligns the character with the grid
so what happens if you are aligned with the grid and hold up+right? something like this:
step 1:
- character starts moving right (because x axis happens first)
- character is now off-grid, so the up input is ignored and her y speed is zero
step 2:
- character is off-grid, so all input is ignored and she just continues moving right
.....
step M:
- character is still off-grid, but this step will move her back on to the grid
- x axis input is ignored (because off-grid), but x axis move happens and puts her back on grid
- y axis input is not ignored, because character is back on grid! y axis move happens and puts her back off grid, moving up
step M+1:
- character is off-grid, so all input is ignored and she just continues moving up
....
step N
- character is still off-grid, but this step will move her back on to the grid
- all input is ignored because off grid, and x axis move does nothing because her x speed is zero
- y axis move happens and puts her back on grid
step N+1
- same as step 1, cycle repeats
so its entirely just a weird artifact of the simple rules for movement and the execution order.... interesting