fixed
This commit is contained in:
parent
b4905845e6
commit
d5a60336f5
3 changed files with 28 additions and 13 deletions
1
main.lua
1
main.lua
|
|
@ -11,7 +11,6 @@ function love.load()
|
||||||
|
|
||||||
loadSprites()
|
loadSprites()
|
||||||
|
|
||||||
|
|
||||||
inputTimer = Timer.new()
|
inputTimer = Timer.new()
|
||||||
player = Player:new(2, 1, "green")
|
player = Player:new(2, 1, "green")
|
||||||
end
|
end
|
||||||
|
|
|
||||||
16
player.lua
16
player.lua
|
|
@ -1,23 +1,17 @@
|
||||||
require "entity"
|
require "entity"
|
||||||
|
|
||||||
Player = class("Player")
|
Player = class("Player", Entity)
|
||||||
|
|
||||||
function Player:initialize(x, y, color)
|
function Player:initialize(x, y, color)
|
||||||
|
|
||||||
local entityTable = {
|
Entity.initialize(self, {
|
||||||
x = x,
|
x = x,
|
||||||
y = y,
|
y = y,
|
||||||
sizeX = 1,
|
sizeX = 3,
|
||||||
sizeY = 1,
|
sizeY = 3,
|
||||||
color = color,
|
color = color,
|
||||||
collision = "none" --player can't push other player
|
collision = "none" --player can't push other player
|
||||||
}
|
})
|
||||||
|
|
||||||
Entity.initialize(self, entityTable)
|
|
||||||
--need to probably get rid of middleclass
|
|
||||||
--and roll yr own for default method inheritance
|
|
||||||
self.getDrawPos = Entity.getDrawPos
|
|
||||||
self.getGridPos = Entity.getGridPos
|
|
||||||
|
|
||||||
self.sprite = playerSprite
|
self.sprite = playerSprite
|
||||||
end
|
end
|
||||||
|
|
|
||||||
24
room.lua
24
room.lua
|
|
@ -1,6 +1,14 @@
|
||||||
Room = class("Room")
|
Room = class("Room")
|
||||||
|
require "player"
|
||||||
|
|
||||||
function Room:initialize()
|
function Room:initialize(t)
|
||||||
|
self.exits = t.exits
|
||||||
|
self.name = t.name
|
||||||
|
self.player = {}
|
||||||
|
|
||||||
|
for color, coords in ipairs(t.playerColors) do
|
||||||
|
self.player[color] = Player:new(coords.x, coords.y, color)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -10,4 +18,18 @@ end
|
||||||
|
|
||||||
function Room:update()
|
function Room:update()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function Room:tick()
|
||||||
|
self:nextRoomCheck()
|
||||||
|
end
|
||||||
|
|
||||||
|
function Room:nextRoomCheck()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function nextRoom()
|
||||||
|
-- currentRoom = Room:new{
|
||||||
|
|
||||||
|
-- }
|
||||||
end
|
end
|
||||||
Loading…
Add table
Add a link
Reference in a new issue