From 8b83d3a2af0cb7ce83d97176c8822456a8109862 Mon Sep 17 00:00:00 2001 From: twobit Date: Sat, 20 Aug 2011 21:29:42 +0200 Subject: [PATCH] start ledwall bomberman --- bomb/conf.lua | 6 ++++ bomb/helper.lua | 1 + bomb/level.txt | 15 +++++++++ bomb/lust.lua | 1 + bomb/main.lua | 90 +++++++++++++++++++++++++++++++++++++++++++++++++ bomb/wall.lua | 1 + 6 files changed, 114 insertions(+) create mode 100644 bomb/conf.lua create mode 120000 bomb/helper.lua create mode 100644 bomb/level.txt create mode 120000 bomb/lust.lua create mode 100644 bomb/main.lua create mode 120000 bomb/wall.lua diff --git a/bomb/conf.lua b/bomb/conf.lua new file mode 100644 index 0000000..0bcfd51 --- /dev/null +++ b/bomb/conf.lua @@ -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 diff --git a/bomb/helper.lua b/bomb/helper.lua new file mode 120000 index 0000000..039178c --- /dev/null +++ b/bomb/helper.lua @@ -0,0 +1 @@ +../lib/helper.lua \ No newline at end of file diff --git a/bomb/level.txt b/bomb/level.txt new file mode 100644 index 0000000..9bd4932 --- /dev/null +++ b/bomb/level.txt @@ -0,0 +1,15 @@ +############### +# # +# # # # # # # # +# # +# # # # # # # # +# # +# # # # # # # # +# # +# # # # # # # # +# # +# # # # # # # # +# # +# # # # # # # # +# # +############### diff --git a/bomb/lust.lua b/bomb/lust.lua new file mode 120000 index 0000000..f6e54d1 --- /dev/null +++ b/bomb/lust.lua @@ -0,0 +1 @@ +../lib/lust.lua \ No newline at end of file diff --git a/bomb/main.lua b/bomb/main.lua new file mode 100644 index 0000000..e5c2818 --- /dev/null +++ b/bomb/main.lua @@ -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 diff --git a/bomb/wall.lua b/bomb/wall.lua new file mode 120000 index 0000000..d37ae93 --- /dev/null +++ b/bomb/wall.lua @@ -0,0 +1 @@ +../lib/wall.lua \ No newline at end of file