nominally working hopping demo
This commit is contained in:
50
main.lua
Normal file
50
main.lua
Normal 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
|
||||
Reference in New Issue
Block a user