blob: 1034d710969b58bdd40a2e95c9cb761d12843419 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
-- `Ground`
-- Collision category: [1]
-- Metatable of `Ground`
-- nils initialized in constructor
Ground = {
body = nil,
shape = nil,
fixture = nil,
sprite = nil
}
-- Constructor of `Ground`
function Ground:new (world, x, y, shape, sprite)
local o = {}
setmetatable(o, self)
self.__index = self
o.body = love.physics.newBody(world, x, y)
o.shape = love.physics.newPolygonShape(shape)
o.fixture = love.physics.newFixture(o.body, o.shape)
o.sprite = love.graphics.newImage(sprite)
o.fixture:setCategory(1)
o.fixture:setFriction(0.2)
return o
end
|