im working on some things and testing some stuff. and one that is burning me is getting players/characters to turn.
now what it is i have already is the movement, which is fine and dandy really. but im not one to just use 'up goes up, down goes down' etc. what im after is up always means 'going forward', you have to turn your character to go forward in the direction you need. only the left & right are used to turn. down can be used to reverse. i guess like micro machines, if that helps
here is the code i have already, which works well if you want 8 dimension control where up is up down is down and so forth, and im just figuring out the turning, but im running intho a block. i actualy figured this out in gamemaker, but cant seem to get it with LOVE, though more than likely its an easy outcome
Code: Select all
------ moving player ------
function player_move(dt)
------ best so far ------
if love.keyboard.isDown ("up") then
playerY = math.floor(playerY - 3)
end
if love.keyboard.isDown("down") then
playerY = math.floor(playerY + 3)
end
if love.keyboard.isDown("left") then
playerX = math.floor(playerX - 3)
end
if love.keyboard.isDown("right") then
playerX = math.floor(playerX + 3)
end
end