From c9a814a173e70746b8756ca39bd1fdc694610e8a Mon Sep 17 00:00:00 2001 From: Fernando Carmona Varo Date: Sun, 8 Nov 2015 14:06:09 +0100 Subject: Added green mushroom to mario, it'll spawn when there are only 10 coins left --- mario/blocks.lua | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'mario/blocks.lua') diff --git a/mario/blocks.lua b/mario/blocks.lua index 4c493d4..66829e2 100644 --- a/mario/blocks.lua +++ b/mario/blocks.lua @@ -87,8 +87,8 @@ minetest.register_node("mario:mushroom",{ walkable = false, groups = {cracky = 3}, node_box = nbox, - on_destruct = function(pos) - minetest.sound_play("mario-bonus", {pos = pos,max_hear_distance = 40,gain = 10.0,}) + on_timer = function(pos, dtime) + minetest.remove_node(pos) end, on_player_collision = function(pos, player, gameid) minetest.remove_node(pos) @@ -111,11 +111,16 @@ minetest.register_node("mario:mushroom_green",{ walkable = false, groups = {cracky = 3}, node_box = nbox, - on_destruct = function(pos) - minetest.sound_play("mario-1-up", {pos = pos,max_hear_distance = 40,gain = 10.0,}) + on_timer = function(pos, dtime) + minetest.remove_node(pos) end, on_player_collision = function(pos, player, gameid) minetest.remove_node(pos) + minetest.sound_play("mario-1-up", {pos = pos,max_hear_distance = 6,gain = 10.0,}) + local gamestate = mario.games[gameid] + if gamestate then + gamestate.lives = gamestate.lives + 1 + end mario.on_player_got_mushroom(player, 15) end }) -- cgit v1.2.3