I implemented code for wall detection and now the player moves diagonally across the y-axis, rather than just straight up and down. What am I missing?
Sorry, this cartridge is not currently available.
P#45114 2017-10-11 11:17 ( Edited 2017-10-11 15:57)
In each of the elseif btn(...) blocks you're modifying the X value.
example :
elseif btn(3) then if(solid_tile(player.x,player.y+8+1) == false) then player.x += 1 else player.y += 0.2 end player.y += player.speed movey() player.flipv = false end |
To be honest, I don't understand this. Why are you adding 1 to player.x? Shouldn't it look more like this?
elseif btn(3) then if(solid_tile(player.x,player.y+8+1) == false) then player.y += player.speed end movey() player.flipv = false end |
P#45115 2017-10-11 11:29 ( Edited 2017-10-11 15:29)
[Please log in to post a comment]