Compare commits
No commits in common. "0aa9418dc2dbedcbab0a2c0a41bc9a64a8a106b7" and "444e4305c52e7640df41b3bc70b1a6c800f6a5d1" have entirely different histories.
0aa9418dc2
...
444e4305c5
76
main.lua
76
main.lua
|
|
@ -289,16 +289,6 @@ local function find_unattached_bubbles()
|
||||||
return unattached
|
return unattached
|
||||||
end
|
end
|
||||||
|
|
||||||
-- don't allow aiming backwards or straight sideways
|
|
||||||
local function clamp_launcher_angle(angle)
|
|
||||||
if (angle >= 0 and angle <= tau / 4) or angle > tau * 25 / 26 then
|
|
||||||
angle = tau * 25 / 26
|
|
||||||
elseif angle > tau / 4 and angle < tau * 14 / 26 then
|
|
||||||
angle = tau * 14 / 26
|
|
||||||
end
|
|
||||||
return angle
|
|
||||||
end
|
|
||||||
|
|
||||||
local function start_level()
|
local function start_level()
|
||||||
game.game_over = false
|
game.game_over = false
|
||||||
game.paused = false
|
game.paused = false
|
||||||
|
|
@ -454,6 +444,29 @@ function love.update(dt)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if game.paused or game.game_over then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if game.show_aim_guide then
|
||||||
|
for i = 1, #game.aim_guide do
|
||||||
|
local dot = game.aim_guide[i]
|
||||||
|
if dot.tween then
|
||||||
|
if dot.tween.delay == 0 then
|
||||||
|
dot.tween.t = dot.tween.t + 1
|
||||||
|
if dot.tween.t == dot.tween.d then
|
||||||
|
dot.tween.t = 0
|
||||||
|
else
|
||||||
|
dot.x = easing.linear(dot.tween.t, dot.tween.b_x, dot.tween.c_x, dot.tween.d)
|
||||||
|
dot.y = easing.linear(dot.tween.t, dot.tween.b_y, dot.tween.c_y, dot.tween.d)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
dot.tween.delay = dot.tween.delay - 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if game.current_bubble and game.current_bubble.tween then
|
if game.current_bubble and game.current_bubble.tween then
|
||||||
game.current_bubble.tween.t = game.current_bubble.tween.t + 1
|
game.current_bubble.tween.t = game.current_bubble.tween.t + 1
|
||||||
if game.current_bubble.tween.t == game.current_bubble.tween.d then
|
if game.current_bubble.tween.t == game.current_bubble.tween.d then
|
||||||
|
|
@ -484,29 +497,6 @@ function love.update(dt)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if game.paused or game.game_over then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if game.show_aim_guide then
|
|
||||||
for i = 1, #game.aim_guide do
|
|
||||||
local dot = game.aim_guide[i]
|
|
||||||
if dot.tween then
|
|
||||||
if dot.tween.delay == 0 then
|
|
||||||
dot.tween.t = dot.tween.t + 1
|
|
||||||
if dot.tween.t == dot.tween.d then
|
|
||||||
dot.tween.t = 0
|
|
||||||
else
|
|
||||||
dot.x = easing.linear(dot.tween.t, dot.tween.b_x, dot.tween.c_x, dot.tween.d)
|
|
||||||
dot.y = easing.linear(dot.tween.t, dot.tween.b_y, dot.tween.c_y, dot.tween.d)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
dot.tween.delay = dot.tween.delay - 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if game.ceiling_drop_tween then
|
if game.ceiling_drop_tween then
|
||||||
local old_y = game.ceiling_bottom
|
local old_y = game.ceiling_bottom
|
||||||
game.ceiling_drop_tween.t = game.ceiling_drop_tween.t + 1
|
game.ceiling_drop_tween.t = game.ceiling_drop_tween.t + 1
|
||||||
|
|
@ -975,17 +965,6 @@ function love.mousepressed(x, y, button, is_touch, presses)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.wheelmoved(x, y)
|
|
||||||
if y ~= 0 then
|
|
||||||
local angle = game.launcher_rotation
|
|
||||||
angle = angle + (y < 0 and 0.01 or -0.01)
|
|
||||||
game.launcher_rotation = clamp_launcher_angle(angle)
|
|
||||||
if game.show_aim_guide then
|
|
||||||
generate_aim_guide(game.launcher_rotation)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function love.mousemoved(x, y, dx, dy, is_touch)
|
function love.mousemoved(x, y, dx, dy, is_touch)
|
||||||
if not game.game_over then
|
if not game.game_over then
|
||||||
local diff_x = x - game.launcher_x
|
local diff_x = x - game.launcher_x
|
||||||
|
|
@ -997,7 +976,14 @@ function love.mousemoved(x, y, dx, dy, is_touch)
|
||||||
angle = angle + tau
|
angle = angle + tau
|
||||||
end
|
end
|
||||||
|
|
||||||
game.launcher_rotation = clamp_launcher_angle(angle)
|
-- don't allow aiming backwards
|
||||||
|
if (angle >= 0 and angle <= tau / 4) or angle >= tau * 25 / 26 then
|
||||||
|
angle = tau * 25 / 26
|
||||||
|
elseif angle >= tau / 4 and angle <= tau * 14 / 26 then
|
||||||
|
angle = tau * 14 / 26
|
||||||
|
end
|
||||||
|
|
||||||
|
game.launcher_rotation = angle
|
||||||
|
|
||||||
if game.show_aim_guide then
|
if game.show_aim_guide then
|
||||||
generate_aim_guide(game.launcher_rotation)
|
generate_aim_guide(game.launcher_rotation)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue