aboutsummaryrefslogtreecommitdiffstats
path: root/Scripts
diff options
context:
space:
mode:
authorAndy Belle-Isle <drumsetmonkey@gmail.com>2019-09-01 01:25:14 -0400
committerAndy Belle-Isle <drumsetmonkey@gmail.com>2019-09-01 01:25:14 -0400
commitf2411141e364766b1294f1b3d9e1a307b9de0c24 (patch)
tree3fb80cf5a4357f0b060035ef8c8e4f6fa191bb2f /Scripts
parentefec4f7b42b12d4765da5a886fcf2c5279c8caaf (diff)
Game loop now updates position every tick, and added circular movement to dog
Diffstat (limited to 'Scripts')
-rw-r--r--Scripts/init.lua14
1 files changed, 8 insertions, 6 deletions
diff --git a/Scripts/init.lua b/Scripts/init.lua
index 596fe38..ad69ae6 100644
--- a/Scripts/init.lua
+++ b/Scripts/init.lua
@@ -12,12 +12,12 @@ bird = {
dog = {
Velocity = {
- x = 0.01,
- y = 10.5
+ x = 0.0,
+ y = 0.0
},
Position = {
- x = 6.5,
- y = 1.3
+ x = 50,
+ y = 0
},
Render = {
texture = "assets/tex.png",
@@ -26,8 +26,11 @@ dog = {
Init = function(self)
print(self.Position.x .. "," .. self.Position.y)
end,
+ counter = 0;
Idle = function(self)
- self.Position.x = self.Position.x + 0.01;
+ 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
}
@@ -41,7 +44,6 @@ animal = {
birdSpawn = game.spawn(bird);
dogSpawn = game.spawn(dog);
-dogSpawn.Position.x = 37.5
animalSpawn = game.spawn(animal);
print("Animal pos: " .. animalSpawn.Position.x)