bjorn 10 年之前
父節點
當前提交
509f5f37be
共有 3 個文件被更改,包括 5 次插入1 次删除
  1. 1 0
      dinoland.lua
  2. 二進制
      media/sounds/grunt.ogg
  3. 4 1
      person.lua

+ 1 - 0
dinoland.lua

@@ -5,6 +5,7 @@ Dinoland.groundHeight = 100
 
 function Dinoland:init()
   self.zones = {}
+  self.name = 'dinoland'
 
   self.obstacles = {}
 

二進制
media/sounds/grunt.ogg


+ 4 - 1
person.lua

@@ -92,6 +92,10 @@ end
 ----------------
 function Person:hop(direction)
   self.body:applyLinearImpulse(30 * direction, -45)
+
+  if ctx.map.name == 'dinoland' and self.gender == 'male' then
+    ctx.sound:play('grunt')
+  end
 end
 
 function Person:directionTo(object)
@@ -121,7 +125,6 @@ function Person.dead:enter()
   self.body:applyLinearImpulse(-200 + love.math.random() * 400, -200 + love.math.random() * -500)
   self.body:setAngularVelocity(-20 + love.math.random() * 40)
   ctx.hud:addScore(10, 'person')
-  ctx.sound:play('pop')
   if self.gender == 'male' and love.math.random() < .75 then
     self.screamSound = ctx.sound:play('scream2', function(sound)
       sound:setVolume(.75)