Develop #4
@@ -3,6 +3,7 @@ local tools = require 'assets/scripts/tools'
|
||||
local HC = require 'assets/scripts/vendor/HC'
|
||||
|
||||
local bell = {}
|
||||
local collision_debug = true
|
||||
|
||||
function bell.load(game, cam)
|
||||
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:pause()
|
||||
|
||||
local collision_size = body.img:getHeight() / 2
|
||||
local cam_x, cam_y = cam:getVisible()
|
||||
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.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.x = cam_x + (game.window.width / 4 * 2) - (bell_1.img:getWidth() / body.num_frames / 2)
|
||||
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_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)
|
||||
if collision_debug then
|
||||
bell_1.collision:draw('fill')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -17,11 +17,8 @@ function game.load()
|
||||
love.physics.setMeter(world_meter) -- Height earth in meters
|
||||
game.world = love.physics.newWorld(0, gravity * world_meter, true) -- Make earth
|
||||
|
||||
-- Collisions
|
||||
--game.collisions = HC.new(150)
|
||||
|
||||
-- Bells
|
||||
bells_enable = false
|
||||
bells_enable = true
|
||||
end
|
||||
|
||||
return game
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 606 KiB After Width: | Height: | Size: 656 KiB |
Reference in New Issue
Block a user