diff options
Diffstat (limited to 'Scripts/init.lua')
-rw-r--r-- | Scripts/init.lua | 78 |
1 files changed, 65 insertions, 13 deletions
diff --git a/Scripts/init.lua b/Scripts/init.lua index 59920c1..4a874b2 100644 --- a/Scripts/init.lua +++ b/Scripts/init.lua @@ -9,20 +9,29 @@ bird = { y = 0.0 }, Name = "bord", - Init = function(self) - print(self.Position.x .. "," .. self.Position.y) - print("Bird spawn") - end, Render = { - texture = "", + texture = "Assets/player.png", visible = true }, + Light = { + r = 1.0, + g = 1.0, + b = 1.0, + strength = 1.0 + }, Idle = function(self) - if (self.visibleTick >= 20) then - self.Render.visible = not self.Render.visible - self.visibleTick = 0 + --if (self.visibleTick >= 20) then + -- self.Render.visible = not self.Render.visible + -- self.visibleTick = 0 + --end + --self.visibleTick = self.visibleTick + 1 + end, + PhysicsIdle = function(self) + if self.Velocity.x < 0 then + self.Render.flipx = true + elseif self.Velocity.x > 0 then + self.Render.flipx = false end - self.visibleTick = self.visibleTick + 1 end, visibleTick = 0 } @@ -38,16 +47,21 @@ cat = { }, Render = { texture = "Assets/cat.png", + normal = "Assets/cat_normal.png", visible = true }, - Init = function(self) - print(self.Position.x .. "," .. self.Position.y) - end, counter = 0; Idle = function(self) 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, + PhysicsIdle = function(self) + if self.Velocity.x < 0 then + self.Render.flipx = true + elseif self.Velocity.x > 0 then + self.Render.flipx = false + end end } @@ -58,9 +72,15 @@ animal = { y = 0.0 }, Render = { - texture = "Assets/cat.png", + texture = "Assets/rabbit.png", visible = true }, + Light = { + r = 0.0, + b = 1.0, + g = 0.2, + strength = 1.0 + }, Idle = function(self) self.Velocity.x = -200 * math.sin(math.rad(self.counter)); self.Velocity.y = 500 * math.cos(math.rad(self.counter*5)); @@ -69,8 +89,40 @@ animal = { counter = 0; } +wall = { + Position = { + y = -100 + }, + Render = { + texture = "Assets/rock.png", + normal = "Assets/rock_normal.png", + visible = true + } +} + birdSpawn = game.spawn(bird); dogSpawn = game.spawn(cat); animalSpawn = game.spawn(animal); + +wallSpawn = game.spawn(wall); + +game.spawn({ + Velocity = { + x = 0, + y = 0 + }, + Light = { + r = 0.8, + g = 0.1, + b = 0.2, + strength = 0.75 + }, + counter = 0; + Idle = function(self) + 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 +}); |