From ea35ad60506407040f7b9fae65c5bdc18f9576bb Mon Sep 17 00:00:00 2001 From: Andy Belle-Isle Date: Mon, 2 Sep 2019 01:05:57 -0400 Subject: Added Lua update function that allows certain entities to update every loop --- Scripts/init.lua | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'Scripts') 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)); -- cgit v1.2.3