Permalink
Browse files

DDR EVEN BETTER - Collision no longer global

  • Loading branch information...
1 parent be574a1 commit 0814ca2ed777f9aa0c4d8be5b241169cace44f97 @mbs6597 mbs6597 committed Mar 12, 2012
@@ -9,7 +9,15 @@ return {
-- initialize library
HC = require 'hardoncollider'
- self.Collider = HC(100, on_collision, collision_stop)
+ local oc = function(dt, shape_a, shape_b, mtv_x, mtv_y)
+ self:on_collision(dt, shape_a, shape_b, mtv_x, mtv_y)
+ end
+
+ local osc = function(dt, shape_a, shape_b)
+ --nothing
+ end
+
+ self.Collider = HC(100, oc, osc)
self.music = love.audio.newSource(basePath.."f_000240.wav")
self.sound = love.audio.newSource(basePath.."BeepWin.wav")
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -37,6 +37,10 @@ return {
love.graphics.newImage(basePath.."up.png"),
love.graphics.newImage(basePath.."right.png")
}
+ self.back_images = {
+ love.graphics.newImage(basePath.."back1.png"),
+ love.graphics.newImage(basePath.."back2.png")
+ }
self.sound = love.audio.newSource(basePath.."heman30.mp3")
self.playing = false
self.ddr_score = 5*self.hitRange
@@ -56,6 +60,12 @@ return {
self.draw = function(self)
love.graphics.print(""..self.ddr_score,love.graphics.getWidth()-100,10)
+
+
+ local backImage = self.back_images[ (math.floor(self.elapsed_time*2)%2)+1]
+ love.graphics.draw(backImage, love.graphics.getWidth()/2-backImage:getWidth()/2,
+ love.graphics.getHeight()/2-backImage:getHeight()/2,0,1,1)
+
for i=1,#self.staticArrows do
self:drawArrow(self.staticArrows[i],0)
end
View
@@ -91,15 +91,3 @@ function love.mousereleased(x, y, button)
pcall(function() framework.currentGame:mousereleased(x, y, button) end)
end
end
-
-function on_collision(dt, shape_a, shape_b, mtv_x, mtv_y)
- if framework.currentGame ~= nil then
- pcall(function() framework.currentGame:on_collision(dt,shape_a,shape_b,mtv_x,mtv_y) end)
- end
-end
-
-function stop_collision(dt, shape_a, shape_b)
- if framework.currentGame ~= nil then
- pcall(function() framework.currentGame:stop_collision(dt,shape_a,shape_b) end)
- end
-end

0 comments on commit 0814ca2

Please sign in to comment.