aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClyne Sullivan <clyne@bitgloo.com>2020-05-09 09:06:32 -0400
committerClyne Sullivan <clyne@bitgloo.com>2020-05-09 09:06:32 -0400
commit1c52ee2e02bc3c09e7cac3b20c81c910b7151144 (patch)
tree63b6190c19036c4738f448baf81911fe4153baf3
parent5b1c22529a946a782a8376de2b34c28348d078d1 (diff)
Added npc
-rw-r--r--Scripts/init.lua33
1 files changed, 33 insertions, 0 deletions
diff --git a/Scripts/init.lua b/Scripts/init.lua
index ec9e350..dc5093b 100644
--- a/Scripts/init.lua
+++ b/Scripts/init.lua
@@ -82,11 +82,44 @@ ball = {
end,
}
+npc = {
+ Position = {
+ x = 30,
+ y = 75
+ },
+ Velocity = {
+ x = 0.0,
+ y = 0.0
+ },
+ Physics = 0,
+ Name = "Paul",
+ Render = {
+ texture = "Assets/cat.png",
+ visible = true
+ },
+ Light = {
+ r = 1.0,
+ g = 1.0,
+ b = 1.0,
+ strength = 0.5
+ },
+ Idle = function(self)
+ if (self.visibleTick == 0) then
+ self.visibleTick = math.random(40, 60)
+ self.Velocity.x = math.random(-1, 1) * 1.0
+ else
+ self.visibleTick = self.visibleTick - 1
+ end
+ end,
+ visibleTick = 0
+}
+
-- Create the world
dofile("Scripts/world.lua")
playerSpawn = game.spawn(player);
game.spawn(ball);
+game.spawn(npc);
-------------------
-- SERIALIZING --