Develop #4

Merged
wariosolis merged 35 commits from develop into master 2017-01-04 00:04:34 +01:00
3 changed files with 7 additions and 4 deletions
Showing only changes of commit 6b7c56e6f4 - Show all commits
+6
View File
@@ -3,6 +3,7 @@ local tools = require 'assets/scripts/tools'
local HC = require 'assets/scripts/vendor/HC' local HC = require 'assets/scripts/vendor/HC'
local bell = {} local bell = {}
local collision_debug = true
function bell.load(game, cam) function bell.load(game, cam)
local body = { local body = {
@@ -16,10 +17,12 @@ function bell.load(game, cam)
body.animation = anim8.newAnimation(g('1-' .. body.num_frames, 1), body.speed, 'pauseAtEnd') body.animation = anim8.newAnimation(g('1-' .. body.num_frames, 1), body.speed, 'pauseAtEnd')
body.animation:pause() body.animation:pause()
local collision_size = body.img:getHeight() / 2
local cam_x, cam_y = cam:getVisible() local cam_x, cam_y = cam:getVisible()
bell_1 = tools.clone_table(body) bell_1 = tools.clone_table(body)
bell_1.x = cam_x + (game.window.width / 4) - (bell_1.img:getWidth() / body.num_frames / 2) bell_1.x = cam_x + (game.window.width / 4) - (bell_1.img:getWidth() / body.num_frames / 2)
bell_1.y = (game.window.height / 2) - (bell_1.img:getHeight() / 2) bell_1.y = (game.window.height / 2) - (bell_1.img:getHeight() / 2)
bell_1.collision = HC.circle(bell_1.x, bell_1.y, collision_size)
bell_2 = tools.clone_table(body) bell_2 = tools.clone_table(body)
bell_2.x = cam_x + (game.window.width / 4 * 2) - (bell_1.img:getWidth() / body.num_frames / 2) bell_2.x = cam_x + (game.window.width / 4 * 2) - (bell_1.img:getWidth() / body.num_frames / 2)
bell_2.y = bell_1.y bell_2.y = bell_1.y
@@ -39,6 +42,9 @@ function bell.draw()
bell_1.animation:draw(bell_1.img, bell_1.x, bell_1.y) bell_1.animation:draw(bell_1.img, bell_1.x, bell_1.y)
bell_2.animation:draw(bell_2.img, bell_2.x, bell_2.y) bell_2.animation:draw(bell_2.img, bell_2.x, bell_2.y)
bell_3.animation:draw(bell_3.img, bell_3.x, bell_3.y) bell_3.animation:draw(bell_3.img, bell_3.x, bell_3.y)
if collision_debug then
bell_1.collision:draw('fill')
end
end end
end end
+1 -4
View File
@@ -17,11 +17,8 @@ function game.load()
love.physics.setMeter(world_meter) -- Height earth in meters love.physics.setMeter(world_meter) -- Height earth in meters
game.world = love.physics.newWorld(0, gravity * world_meter, true) -- Make earth game.world = love.physics.newWorld(0, gravity * world_meter, true) -- Make earth
-- Collisions
--game.collisions = HC.new(150)
-- Bells -- Bells
bells_enable = false bells_enable = true
end end
return game return game
Binary file not shown.

Before

Width:  |  Height:  |  Size: 606 KiB

After

Width:  |  Height:  |  Size: 656 KiB