diff options
author | Andy Belle-Isle <drumsetmonkey@gmail.com> | 2019-09-02 01:05:57 -0400 |
---|---|---|
committer | Andy Belle-Isle <drumsetmonkey@gmail.com> | 2019-09-02 01:05:57 -0400 |
commit | ea35ad60506407040f7b9fae65c5bdc18f9576bb (patch) | |
tree | 7933d683cf84c6cd27ae2568404ed6026637b5b8 /Scripts/init.lua | |
parent | e8d3e8f0522b6d7896f1e3d330c70af5376f7c4c (diff) |
Added Lua update function that allows certain entities to update every loop
Diffstat (limited to 'Scripts/init.lua')
-rw-r--r-- | Scripts/init.lua | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Scripts/init.lua b/Scripts/init.lua index 9b8912f..26b2aa7 100644 --- a/Scripts/init.lua +++ b/Scripts/init.lua @@ -26,6 +26,13 @@ bird = { --end --self.visibleTick = self.visibleTick + 1 end, + Update = function(self) + if self.Velocity.x < 0 then + self.Render.flipx = true + elseif self.Velocity.x > 0 then + self.Render.flipx = false + end + end, visibleTick = 0 } @@ -48,6 +55,13 @@ cat = { self.Velocity.x = -100 * math.sin(math.rad(self.counter)); self.Velocity.y = 100 * math.cos(math.rad(self.counter)); self.counter = self.counter + 5; + end, + Update = function(self) + if self.Velocity.x < 0 then + self.Render.flipx = true + elseif self.Velocity.x > 0 then + self.Render.flipx = false + end end } @@ -65,7 +79,7 @@ animal = { r = 0.0, b = 1.0, g = 0.2, - strength = 2.0 + strength = 1.0 }, Idle = function(self) self.Velocity.x = -200 * math.sin(math.rad(self.counter)); |