diff --git a/.DS_Store b/.DS_Store index 6c1a93c..81dee74 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/assets/.DS_Store b/assets/.DS_Store new file mode 100644 index 0000000..bd83215 Binary files /dev/null and b/assets/.DS_Store differ diff --git a/assets/game-over.wav b/assets/game-over.wav new file mode 100644 index 0000000..f4bae3a Binary files /dev/null and b/assets/game-over.wav differ diff --git a/assets/jump.wav b/assets/jump.wav new file mode 100644 index 0000000..316e660 Binary files /dev/null and b/assets/jump.wav differ diff --git a/assets/loop.wav b/assets/loop.wav new file mode 100644 index 0000000..2617637 Binary files /dev/null and b/assets/loop.wav differ diff --git a/assets/loop2.wav b/assets/loop2.wav new file mode 100644 index 0000000..5cb665f Binary files /dev/null and b/assets/loop2.wav differ diff --git a/assets/loop3.wav b/assets/loop3.wav new file mode 100644 index 0000000..5717ff7 Binary files /dev/null and b/assets/loop3.wav differ diff --git a/lib/game.lua b/lib/game.lua index 27e3dfb..e841734 100644 --- a/lib/game.lua +++ b/lib/game.lua @@ -64,15 +64,16 @@ function Game:update_obstacles(dt) else table.insert(self.obstacles_2, 1) end - if self.obstacle_interval > 0.5 then - self.obstacle_interval = self.obstacle_interval - math.random(0, self.obstacle_interval/3) - else - self.obstacle_interval = math.random(0.5, 3) - end self.obstacle_countdown = self.obstacle_countdown + self.obstacle_interval end + if self.obstacle_interval > 0.3 then + self.obstacle_interval = self.obstacle_interval - math.random(0, self.obstacle_interval/2) + else + self.obstacle_interval = math.random(0.2, 3) + end + local threshold = 0.05 local cutoff = 0.5 diff --git a/main.lua b/main.lua index 3c608f1..4075107 100644 --- a/main.lua +++ b/main.lua @@ -27,6 +27,12 @@ function love.load() -- Dimensions. width, height = love.graphics.getDimensions() print('Running in '..width..'x'..height..' mode.') + + jump_sound = love.audio.newSource("assets/jump.wav", "static") + over_sound = love.audio.newSource("assets/game-over.wav", "static") + music = love.audio.newSource("assets/loop.wav") + music2 = love.audio.newSource("assets/loop2.wav") + music3 = love.audio.newSource("assets/loop3.wav") end @@ -200,6 +206,7 @@ function draw_death() love.graphics.setColor(255, 0, 0) love.graphics.printf('GAME OVER', 0, height/2, width, 'center') + over_sound:play() end end @@ -220,7 +227,13 @@ end -- Jump! function jump(dt) + if game.dead then + over_sound:stop() + game:initialize() + end + game:jump(dt) + jump_sound:play() end -- iOS touchscreen support. @@ -229,6 +242,24 @@ function love.touchpressed(id, x, y, dx, dy, pressure) end function love.update(dt) + if game.progress < 1 then + music:play() + else + music:stop() + music2:play() + end + if game.stretch_progress > 1 then + music2:stop() + music3:play() + end + + if game.dead then + music:stop() + music2:stop() + music3:stop() + + end + -- Update the controller. TLbind:update()