From 62b67be7882dffebd6de0c8241d253d806a6905c Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 26 May 2017 19:14:27 +0200 Subject: Halfway through with moving to new OOP module --- not/Entity.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 not/Entity.lua (limited to 'not/Entity.lua') diff --git a/not/Entity.lua b/not/Entity.lua new file mode 100644 index 0000000..6ba1606 --- /dev/null +++ b/not/Entity.lua @@ -0,0 +1,16 @@ +require "not.Sprite" + +--- `Entity` +-- Basic, visible object to be used within World instance. Can be anything. Represented as `Sprite`. +-- We still need to keep old, global way of using modules but there are `returns` on the end at least. +Entity = Sprite:extends() + +Entity.world =--[[not.World]]nil + +-- Simple constructor for `Entity`. +function Entity:new (world, imagePath) + Entity.__super.new(self, imagePath) + self.world = world +end + +return Entity -- cgit v1.1 From 8e7c7d2a4ca74fcb58f36424b05a96d358208e39 Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 26 May 2017 22:46:50 +0200 Subject: Comment on Entity --- not/Entity.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'not/Entity.lua') diff --git a/not/Entity.lua b/not/Entity.lua index 6ba1606..0e21e48 100644 --- a/not/Entity.lua +++ b/not/Entity.lua @@ -3,6 +3,7 @@ require "not.Sprite" --- `Entity` -- Basic, visible object to be used within World instance. Can be anything. Represented as `Sprite`. -- We still need to keep old, global way of using modules but there are `returns` on the end at least. +-- It probably would be nice to move `World` dependency out of it but for now it should stay this way. Later `World` instance could be just passed to methods that need it. Entity = Sprite:extends() Entity.world =--[[not.World]]nil -- cgit v1.1