summaryrefslogtreecommitdiffhomepage
path: root/ground.lua
diff options
context:
space:
mode:
Diffstat (limited to 'ground.lua')
-rw-r--r--ground.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/ground.lua b/ground.lua
new file mode 100644
index 0000000..47c4ec7
--- /dev/null
+++ b/ground.lua
@@ -0,0 +1,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.7)
+ return o
+end \ No newline at end of file