wowowowowowowo so much stuff

This commit is contained in:
0x81c 2015-03-14 05:36:02 -04:00
parent fe21cb61e3
commit 2f40eaf000
249 changed files with 391 additions and 20 deletions

View file

@ -4,6 +4,9 @@ require "player"
require "box"
require "wall"
require "artifact"
require "npc"
require "art"
require "assorted"
function Room:initialize(t)
self.exits = t.exits
@ -24,20 +27,33 @@ function Room:initialize(t)
self.activeColors[color] = true
end
for i=0, 10 do
for i=0, 5 do
local c = randomColor()
local x, y = math.random(1, gridWidth), math.random(1, gridHeight)
self.collideables[c]["b: " .. x .. ", " .. y] = Box:new(x, y, c)
end
for i=0, 10 do
local c = randomColor()
for i=0, 5 do
local x, y = math.random(1, gridWidth), math.random(1, gridHeight)
self.collideables[c]["w: " .. x .. ", " .. y] = Wall:new(x, y, c)
for color, active in pairs(self.activeColors) do
self.collideables[color]["w: " .. x .. ", " .. y] = Wall:new(x, y, color)
end
end
self.collideables["green"]["fpp"] = Artifact:new(6, 6, "green")
-- for color, active in pairs(self.activeColors) do
-- local x, y = 6, 3
-- if active then self.collideables[color]["n: " .. x .. ", " .. y] = Ass:new(x, y, color, "animals/processed/", "me_rach") end
-- local x, y = 1, 1
-- if active then self.collideables[color]["n: " .. x .. ", " .. y] = Ass:new(x, y, color, "tech/processed/", "mac_smaller") end
-- local x, y = 7, 7
-- if active then self.collideables[color]["n: " .. x .. ", " .. y] = Ass:new(x, y, color, "tech/processed/", "cd") end
-- end
-- self.collideables["green"]["fpp"] = Artifact:new(6, 6, "green")
end
@ -162,11 +178,13 @@ end
function Room:tryPlayerMove(entities, pos, axis, direction)
local counter = direction
local entitiesToMove = {}
local origPosAxis = pos[axis]
for _, entity in ipairs(entities) do
pos[axis] = pos[axis] + direction
print(pos[axis])
print(origPosAxis + counter)
if entity:atGridPos(pos.x, pos.y) then
print("HOW????" .. entity)
if entity:canMove() then
table.insert(entitiesToMove, entity)
else
@ -174,7 +192,7 @@ function Room:tryPlayerMove(entities, pos, axis, direction)
return false
end
else
-- break
break
end
counter = counter + direction
end
@ -182,6 +200,7 @@ function Room:tryPlayerMove(entities, pos, axis, direction)
for _, entity in ipairs(entitiesToMove) do
entity:move(axis, direction)
end
print("wowe true")
return true
end