Compare commits
No commits in common. "c225cc6edff5ee25308f36d1732e7ef65dffb871" and "89f9bd1913a3476b062a77b0dd8048cfc4108d7b" have entirely different histories.
c225cc6edf
...
89f9bd1913
4 changed files with 1 additions and 18 deletions
2
main.lua
2
main.lua
|
|
@ -60,8 +60,6 @@ function love.load()
|
|||
}
|
||||
}
|
||||
camera = Camera()
|
||||
|
||||
gotoRoom('Stage')
|
||||
end
|
||||
|
||||
function love.update(dt)
|
||||
|
|
|
|||
|
|
@ -3,14 +3,12 @@
|
|||
---@class Area:Object
|
||||
---@field room Room
|
||||
---@field game_objects GameObject[]
|
||||
---@field world table|nil
|
||||
local Area = Object:extend()
|
||||
|
||||
---Instantiates area
|
||||
function Area:new(room)
|
||||
self.room = room
|
||||
self.game_objects = {}
|
||||
self.world = nil
|
||||
end
|
||||
|
||||
---Updates area
|
||||
|
|
@ -38,10 +36,4 @@ function Area:addGameObject(game_object_type, x, y, opts)
|
|||
return game_object
|
||||
end
|
||||
|
||||
---Initializes HC physics as a world
|
||||
---@param cell_size number|nil
|
||||
function Area:addPhysicsWorld(cell_size)
|
||||
self.world = HC(cell_size or 100)
|
||||
end
|
||||
|
||||
return Area
|
||||
|
|
|
|||
|
|
@ -7,9 +7,6 @@ local Player = GameObject:extend()
|
|||
|
||||
function Player:new(area, x, y, opts)
|
||||
Player.super.new(self, area, x, y, opts)
|
||||
|
||||
self.w, self.h = 12, 12
|
||||
self.collider = self.area.world:circle(self.x, self.y, math.floor(self.w*0.8))
|
||||
end
|
||||
|
||||
function Player:update(dt)
|
||||
|
|
@ -18,10 +15,6 @@ end
|
|||
|
||||
function Player:draw()
|
||||
Player.super.draw(self)
|
||||
love.graphics.setColor(1, 0.4, 0.4)
|
||||
self.collider:draw()
|
||||
love.graphics.setColor(1, 1, 1)
|
||||
love.graphics.circle('line', self.x, self.y, self.w)
|
||||
end
|
||||
|
||||
return Player
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ local Stage = Room:extend()
|
|||
|
||||
function Stage:new()
|
||||
Stage.super.new(self)
|
||||
self.area:addPhysicsWorld()
|
||||
|
||||
self.area:addGameObject('Player', gw/2, gh/2)
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue