nominally working hopping demo

This commit is contained in:
Nick Stokoe
2022-07-02 18:34:16 +01:00
parent 8ff275adac
commit 2367bf83cf
3 changed files with 345 additions and 0 deletions

50
main.lua Normal file
View File

@@ -0,0 +1,50 @@
local newArena = require "arena"
local newQbert = require "qbert"
local arena = newArena(
7,
{3, -3},
{255, 0, 0}, {0, 255, 0}, {0, 0, 255}
)
local time = 0
local qbert = newQbert(
arena
)
function love.load()
end
function love.draw()
arena.draw()
qbert.draw()
end
local dirs = {"se", "sw", "ne", "nw"}
local ix = 1
function love.update(dt)
--[[ time = time + dt
if (time > 2) then
time = 0
local dir = dirs[ix]
ix = (ix+1)%4 + 1
qbert.jump(dir)
end
]]--
if love.keyboard.isDown('i') then
qbert.jump('ne')
end
if love.keyboard.isDown('u') then
qbert.jump('nw')
end
if love.keyboard.isDown('k') then
qbert.jump('se')
end
if love.keyboard.isDown('j') then
qbert.jump('sw')
end
arena.update(dt);
qbert.update(dt);
end