Make slot x,y positions be absolute, not relative

main
Tyler Scott 2022-02-05 07:53:04 +07:00
parent 8d79f8b633
commit e6959f05ec
1 changed files with 12 additions and 10 deletions

View File

@ -106,6 +106,8 @@ function love.load(arg)
game.bubble_type_counts = {} game.bubble_type_counts = {}
local bubble_types = {} local bubble_types = {}
for i = 1, #game.bubble_slots do for i = 1, #game.bubble_slots do
game.bubble_slots[i].x = game.bubble_slots[i].x + game.level_left
game.bubble_slots[i].y = game.bubble_slots[i].y + game.level_top
local bubble_type = game.bubble_slots[i].bubble_type local bubble_type = game.bubble_slots[i].bubble_type
if game.bubble_type_counts[bubble_type] == nil then if game.bubble_type_counts[bubble_type] == nil then
game.bubble_type_counts[bubble_type] = 0 game.bubble_type_counts[bubble_type] = 0
@ -148,21 +150,21 @@ function love.draw()
for i = 1, #game.bubble_slots do for i = 1, #game.bubble_slots do
local slot = game.bubble_slots[i] local slot = game.bubble_slots[i]
if slot.bubble_type >= 1 and slot.bubble_type <= #game.bubble_images then if slot.bubble_type >= 1 and slot.bubble_type <= #game.bubble_images then
love.graphics.setColor(1, 1, 1, 1)
love.graphics.draw( love.graphics.draw(
game.bubble_images[slot.bubble_type], -- image game.bubble_images[slot.bubble_type],
game.level_x + slot.x, -- x slot.x,
game.level_y + slot.y, -- y slot.y,
0, -- rotation 0, 1, 1,
1, -- x scale game.bubble_radius,
1, -- y scale game.bubble_radius
game.bubble_radius, -- x offset
game.bubble_radius -- y offset
) )
else else
love.graphics.setColor(0.4, 0, 0, 1)
love.graphics.circle( love.graphics.circle(
'line', 'line',
game.level_x + slot.x, slot.x,
game.level_y + slot.y, slot.y,
game.bubble_radius game.bubble_radius
) )
end end