-
-
Save kaeza/e748b3807c45a2ef9ca7793ea905e8d0 to your computer and use it in GitHub Desktop.
Minetest - Flash screen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
minetest.register_craftitem("mymod:myitem", { | |
description = "Flash", | |
inventory_image = "default_wood.png", | |
on_use = function(itemstack, user, pointed_thing) | |
if not user:is_player() then return end | |
local plname = user:get_player_name() | |
local hud_id = user:hud_add({ | |
hud_elem_type = "image", | |
position = {x=0, y=0}, | |
text = "mymod_flash.png", | |
alignment = {x=1, y=1}, | |
scale = {x=-100, y=-100}, | |
}) | |
-- Remove "flash" after one second. | |
minetest.after(1, function() | |
user:hud_remove(hud_id) | |
end) | |
user:set_hp(user:get_hp() + 4) | |
end, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment