summaryrefslogtreecommitdiffhomepage
path: root/ground.lua
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2016-05-11 22:23:07 +0200
committerAki <nthirtyone@gmail.com>2016-05-11 22:23:07 +0200
commit664d57ee0fee78a624796c3712abbe7d1a708497 (patch)
tree27896d6121d059a9831903dc9e94e01d28cb3818 /ground.lua
downloadroflnauts-664d57ee0fee78a624796c3712abbe7d1a708497.zip
roflnauts-664d57ee0fee78a624796c3712abbe7d1a708497.tar.gz
roflnauts-664d57ee0fee78a624796c3712abbe7d1a708497.tar.bz2
Initial commit :boom:
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