bjorn преди 10 години
родител
ревизия
8715691654
променени са 3 файла, в които са добавени 52 реда и са изтрити 2 реда
  1. 50 0
      dinoland.lua
  2. 1 1
      main.lua
  3. 1 1
      person.lua

+ 50 - 0
dinoland.lua

@@ -104,6 +104,17 @@ function Dinoland:init(index)
     makeObstacle(4400, 0, 600, 200)
     makeObstacle(4800, 0, 200, 100)
     makeObstacle(4000, 0, 200, 100)
+  elseif self.index == 3 then
+    self.width = 6000
+    self.height = 900
+
+    makeObstacle(2900, 0, 200, 300)
+    makeObstacle(3000, 0, 800, 200)
+    makeObstacle(2800, 0, 800, 100)
+
+    makeObstacle(4200, 0, 100, 400)
+    makeObstacle(4200, 0, 300, 200)
+    makeObstacle(4200, 0, 600, 100)
   end
 
   Map.init(self)
@@ -187,5 +198,44 @@ function Dinoland:spawnHuts()
     for i = 1, 20 do
       ctx.enemies:add(Caveman, {x = 4100 + love.math.random() * 600, y = self.height - self.ground.height - 200})
     end
+  elseif self.index == 3 then
+    makeBuilding(900, 0)
+    makeBuilding(1500, 0)
+    makeBuilding(2100, 0)
+
+    for i = 1, 15 do
+      ctx.enemies:add(Caveman, {x = 1000 + love.math.random() * 400, y = self.height - self.ground.height})
+    end
+
+    for i = 1, 15 do
+      ctx.enemies:add(Caveman, {x = 1600 + love.math.random() * 400, y = self.height - self.ground.height})
+    end
+
+    makeBuilding(2500, 100)
+    makeBuilding(2900, 300)
+    makeBuilding(3000, 0)
+    makeBuilding(3150, 100)
+    makeBuilding(3300, 200)
+
+    for i = 1, 20 do
+      ctx.enemies:add(Caveman, {x = 2600 + love.math.random() * 800, y = self.height - self.ground.height - 200})
+    end
+
+    for i = 1, 8 do
+      ctx.enemies:add(Caveman, {x = 3000 + love.math.random() * 300, y = self.height - self.ground.height})
+    end
+
+    makeBuilding(3950, 100)
+    makeBuilding(4450, 100)
+
+    for i = 1, 10 do
+      ctx.enemies:add(Caveman, {x = 4175 + love.math.random() * 50, y = self.height - self.ground.height - 400})
+    end
+
+    makeBuilding(5000, 200)
+
+    for i = 1, 35 do
+      ctx.enemies:add(Caveman, {x = 4500 + love.math.random() * 600, y = self.height - self.ground.height})
+    end
   end
 end

+ 1 - 1
main.lua

@@ -2,5 +2,5 @@ require 'require'
 
 function love.load()
   data.load()
-  Context:bind(Game, 'Dinoland', 2)
+  Context:bind(Game, 'Dinoland', 3)
 end

+ 1 - 1
person.lua

@@ -78,7 +78,7 @@ function Person:collideWith(other)
     end
   end
 
-  if select(2, self.body:getLinearVelocity()) > 500 then
+  if select(2, self.body:getLinearVelocity()) > 500 and self.state == self.dead then
     if not self.splatted then
       ctx.sound:play('splat')
       ctx.particles:emit('blood', self.body:getX(), self.body:getY(), 8)