Skip to content

Commit

Permalink
start ledwall bomberman
Browse files Browse the repository at this point in the history
  • Loading branch information
2bt committed Aug 20, 2011
1 parent af5eaf8 commit 8b83d3a
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 0 deletions.
6 changes: 6 additions & 0 deletions 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
1 change: 1 addition & 0 deletions bomb/helper.lua
15 changes: 15 additions & 0 deletions bomb/level.txt
@@ -0,0 +1,15 @@
###############
# #
# # # # # # # #
# #
# # # # # # # #
# #
# # # # # # # #
# #
# # # # # # # #
# #
# # # # # # # #
# #
# # # # # # # #
# #
###############
1 change: 1 addition & 0 deletions bomb/lust.lua
90 changes: 90 additions & 0 deletions 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
1 change: 1 addition & 0 deletions bomb/wall.lua

0 comments on commit 8b83d3a

Please sign in to comment.