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