i started creating the gamemanager idea and also the ui, started off with a basic main menu, options light up; added a debug mode which right now displays the name of the key you press, which would be handy for the 3ds

This commit is contained in:
2018-09-01 04:52:54 +02:00
parent bebbc8b82e
commit d0fb98ad8c
5 changed files with 333 additions and 5 deletions

View File

@@ -63,6 +63,94 @@ function snakeplayer:hardreset()
snake.score = 0
end
function snakeplayer:keypressed(key)
if (key == "start") then
--gamemanager:quit()
gamemanager:pause()
end
if (key == "up") then
snakeplayer:move(0, -1)
end
if (key == "down") then
snakeplayer:move(0, 1)
end
if (key == "left") then
snakeplayer:move(-1, 0)
end
if (key == "right") then
snakeplayer:move(1, 0)
end
if (key == "cstickup") then
snakeplayer:move(0, -1)
end
if (key == "cstickdown") then
snakeplayer:move(0, 1)
end
if (key == "cstickleft") then
snakeplayer:move(-1, 0)
end
if (key == "cstickright") then
snakeplayer:move(1, 0)
end
if (key == "cpadup") then
snakeplayer:move(0, -1)
end
if (key == "cpaddown") then
snakeplayer:move(0, 1)
end
if (key == "cpadleft") then
snakeplayer:move(-1, 0)
end
if (key == "cpadright") then
snakeplayer:move(1, 0)
end
if (key == "x") then
snakeplayer:move(0, -1)
end
if (key == "b") then
snakeplayer:move(0, 1)
end
if (key == "y") then
snakeplayer:move(-1, 0)
end
if (key == "a") then
snakeplayer:move(1, 0)
end
if (key == "select") then
--snakeplayer:hardreset()
end
if (key == "lbutton") then
end
if (key == "rbutton") then
end
if (key == "l") then
end
if (key == "r") then
end
if (key == "lzbutton") then
end
if (key == "rzbutton") then
end
end
function snakeplayer:move(xvel, yvel)
if self.xvel == -xvel and self.yvel == -yvel then