diff options
Diffstat (limited to 'objects/Obstacle.lua')
| -rw-r--r-- | objects/Obstacle.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/objects/Obstacle.lua b/objects/Obstacle.lua new file mode 100644 index 0000000..0115f36 --- /dev/null +++ b/objects/Obstacle.lua @@ -0,0 +1,16 @@ +Obstacle = {} +Obstacle.__index = Obstacle + +function Obstacle:new(name, location, body) + local obj = { + name = name, + presetLocation = (type(location) == "string" and location) or nil, + x = (type(location) == "table" and location.x) or nil, + y = (type(location) == "table" and location.y) or nil, + body = body or Body:new("rectangle", 10, 10) + } + + setmetatable(obj, Obstacle) + + return obj +end |
