summaryrefslogtreecommitdiff
path: root/mario/blocks.lua
diff options
context:
space:
mode:
authorFernando Carmona Varo <ferkiwi@gmail.com>2015-11-08 14:06:09 +0100
committerFernando Carmona Varo <ferkiwi@gmail.com>2015-11-08 14:06:09 +0100
commitc9a814a173e70746b8756ca39bd1fdc694610e8a (patch)
tree697d53f17ee865cf030d1887a59c15a511ee8c77 /mario/blocks.lua
parente57a87c26466b430557f853975fbc2d0e9f17765 (diff)
Added green mushroom to mario, it'll spawn when there are only 10 coins left
Diffstat (limited to 'mario/blocks.lua')
-rw-r--r--mario/blocks.lua13
1 files changed, 9 insertions, 4 deletions
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
})