Skip to content

Commit

Permalink
Fix notification positioning
Browse files Browse the repository at this point in the history
Fixes #55, also fixes @Fixer-007
  • Loading branch information
rubenwardy committed Apr 5, 2018
1 parent 75c01a1 commit 3727596
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ function awards.unlock(name, award)
name = "award_bg",
scale = {x = 2, y = 1},
text = background,
position = {x = 0.5, y = 0},
position = {x = 0.5, y = 0.05},
offset = {x = 0, y = 138},
alignment = {x = 0, y = -1}
})
Expand All @@ -444,8 +444,8 @@ function awards.unlock(name, award)
number = 0xFFFFFF,
scale = {x = 100, y = 20},
text = hud_announce,
position = {x = 0.5, y = 0},
offset = {x = 0, y = 40},
position = {x = 0.5, y = 0.05},
offset = {x = 0, y = 45},
alignment = {x = 0, y = -1}
})
local three = player:hud_add({
Expand All @@ -454,24 +454,27 @@ function awards.unlock(name, award)
number = 0xFFFFFF,
scale = {x = 100, y = 20},
text = title,
position = {x = 0.5, y = 0},
offset = {x = 30, y = 100},
position = {x = 0.5, y = 0.05},
offset = {x = 0, y = 100},
alignment = {x = 0, y = -1}
})
local four = player:hud_add({
hud_elem_type = "image",
name = "award_icon",
scale = {x = 4, y = 4},
text = icon,
position = {x = 0.4, y = 0},
offset = {x = -81.5, y = 126},
position = {x = 0.5, y = 0.05},
offset = {x = -200.5, y = 126},
alignment = {x = 0, y = -1}
})
minetest.after(4, function()
player:hud_remove(one)
player:hud_remove(two)
player:hud_remove(three)
player:hud_remove(four)
local player2 = minetest.get_player_by_name(name)
if player2 then
player2:hud_remove(one)
player2:hud_remove(two)
player2:hud_remove(three)
player2:hud_remove(four)
end
end)
end
end
Expand Down

0 comments on commit 3727596

Please sign in to comment.