diff options
author | Clyne Sullivan <clyne@bitgloo.com> | 2019-09-02 15:15:26 -0400 |
---|---|---|
committer | Clyne Sullivan <clyne@bitgloo.com> | 2019-09-02 15:15:26 -0400 |
commit | 46393662672f2510a40eb6cd5291f99a7ae14e3c (patch) | |
tree | 8b11793b474ebc6e7359289bd9e9704d58a7f58a /Scripts | |
parent | c1161dc0d8939814abf7da48d03b887c0aead0ff (diff) | |
parent | 062a7e2baad74f49f2548793a25f0cf5e4ae6f86 (diff) |
Merge branch 'master' of https://github.com/tcsullivan/gamedev2 into save-load
Diffstat (limited to 'Scripts')
-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 +}); |