Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
function love.conf(t) | ||
t.screen.width = 320 | ||
t.screen.height = 300 | ||
t.modules.physics = false | ||
t.modules.mouse = false | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../lib/helper.lua |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
############### | ||
# # | ||
# # # # # # # # | ||
# # | ||
# # # # # # # # | ||
# # | ||
# # # # # # # # | ||
# # | ||
# # # # # # # # | ||
# # | ||
# # # # # # # # | ||
# # | ||
# # # # # # # # | ||
# # | ||
############### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../lib/lust.lua |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
require "helper" | ||
require "wall" | ||
|
||
Player = Object:new() | ||
function Player:init(nr, x, y) | ||
self.nr = nr | ||
self.x = x | ||
self.y = y | ||
|
||
end | ||
|
||
|
||
|
||
Level = Object:new() | ||
function Level:init(filename) | ||
|
||
local file = io.open(filename) | ||
self.walls = {} | ||
self.players = {} | ||
|
||
for y = 1, 15 do | ||
local row = {} | ||
local line = file:read() | ||
for x = 1, 15 do | ||
local cell = line:sub(x, x) | ||
if ("1234"):find(cell) then | ||
table.insert(self.players, Player(tonumber(cell), x, y)) | ||
end | ||
if ("#m"):find(cell) then | ||
row[x] = cell | ||
else | ||
row[x] = " " | ||
end | ||
end | ||
self.walls[y] = row | ||
end | ||
|
||
end | ||
|
||
function Level:draw() | ||
local colors = { | ||
[" "] = "114411", | ||
["#"] = "666666", | ||
} | ||
for y, row in ipairs(self.walls) do | ||
for x, cell in ipairs(row) do | ||
wall:pixel(x - 1, y - 1, colors[cell]) | ||
end | ||
end | ||
end | ||
|
||
|
||
|
||
function love.keypressed(key) | ||
if key == "escape" then | ||
love.event.push "q" | ||
|
||
elseif key == "f1" then | ||
wall:record(true) | ||
print("recording...") | ||
|
||
elseif key == "f2" then | ||
wall:record(false) | ||
print("recording stopped") | ||
|
||
end | ||
end | ||
|
||
function love.load() | ||
wall = Wall("ledwall", 1338, 3, false) | ||
|
||
level = Level("level.txt") | ||
|
||
tick = 0 | ||
end | ||
|
||
function love.update(dt) | ||
tick = tick + 1 | ||
|
||
wall:update_input() | ||
|
||
end | ||
|
||
|
||
function love.draw() | ||
|
||
level:draw() | ||
-- send the stuff abroad | ||
wall:draw() | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../lib/wall.lua |