Merge branch 'master' of https://github.com/DonBatman/myarcade
Conflicts: mario/gamestate.lua mario/hud.lua mario/init.luamaster
commit
4c03a0e588
|
@ -80,6 +80,7 @@ minetest.register_node("mario:mushroom",{
|
|||
},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
groups = {cracky = 3},
|
||||
node_box = nbox,
|
||||
on_destruct = function(pos)
|
||||
|
@ -99,6 +100,7 @@ minetest.register_node("mario:mushroom_green",{
|
|||
},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
groups = {cracky = 3},
|
||||
node_box = nbox,
|
||||
on_destruct = function(pos)
|
||||
|
|
|
@ -31,8 +31,10 @@ function mario.game_start(pos, player, gamedef)
|
|||
player_name = player_name,
|
||||
pos = pos,
|
||||
player_start = vector.add(pos, (gamedef.player_start or {x=16,y=0,z=1})),
|
||||
|
||||
turtle1_start = vector.add(pos, (gamedef.turtle1_start or {x=3,y=12,z=1})),
|
||||
turtle2_start = vector.add(pos, (gamedef.turtle1_start or {x=30,y=12,z=1})),
|
||||
|
||||
coin_total = gamedef.coin_total or 84,
|
||||
speed = gamedef.speed or 2,
|
||||
lives = gamedef.lives or 3,
|
||||
|
@ -51,6 +53,9 @@ function mario.game_start(pos, player, gamedef)
|
|||
local schem = gamedef
|
||||
minetest.place_schematic({x=pos.x-1,y=pos.y-2,z=pos.z-2},gamedef.schematic,0, "air", true)
|
||||
|
||||
-- initialize player
|
||||
player:set_physics_override(1,1,0.3,true,false)
|
||||
|
||||
-- Set start positions
|
||||
mario.game_reset(id, player)
|
||||
mario.update_hud(id, player)
|
||||
|
@ -76,6 +81,8 @@ function mario.game_end(id)
|
|||
minetest.chat_send_player(gamestate.player_name, "You made it to the highscores! Your Ranking: " .. ranking)
|
||||
end
|
||||
end
|
||||
-- Restore normal physics
|
||||
player:set_physics_override(1,1,1,true,false)
|
||||
-- Clear the data
|
||||
mario.games[id] = nil
|
||||
mario.players[id] = nil
|
||||
|
@ -95,6 +102,7 @@ function mario.game_reset(id, player)
|
|||
-- Position the player
|
||||
local player = player or minetest.get_player_by_name(gamestate.player_name)
|
||||
player:setpos(gamestate.player_start)
|
||||
local pos = gamestate.pos
|
||||
|
||||
-- Spawn the turtles and assign the game id to each turtle
|
||||
minetest.after(2, function()
|
||||
|
@ -150,9 +158,9 @@ function mario.add_mushroom(id)
|
|||
if not gamestate then return end
|
||||
local node = {}
|
||||
-- Different mushroom will be used depending on the level
|
||||
if gamestate.level == 1 then
|
||||
--if gamestate.level == 1 then
|
||||
node.name = "mario:mushroom"
|
||||
end
|
||||
--end
|
||||
local pos = vector.add(gamestate.player_start,{x=0,y=12,z=0})
|
||||
minetest.set_node(pos, node)
|
||||
print(node.param2)
|
||||
|
@ -171,7 +179,7 @@ function mario.on_player_got_coin(player)
|
|||
mario.update_hud(gamestate.id, player)
|
||||
minetest.sound_play("mario-coin", {object = player, max_hear_distance = 6})
|
||||
|
||||
if gamestate.coin_count == 70 or gamestate.coin_count == 180 then
|
||||
if gamestate.coin_count == 10 then
|
||||
mario.add_mushroom(gamestate.id)
|
||||
elseif gamestate.coin_count >= gamestate.coin_total then
|
||||
minetest.chat_send_player(name, "You cleared the board!")
|
||||
|
@ -257,18 +265,9 @@ local function on_player_gamestep(player, gameid)
|
|||
if node.name == "mario:coin" then
|
||||
minetest.remove_node(pos)
|
||||
mario.on_player_got_coin(player)
|
||||
elseif node.name == "mario:cherrys" then
|
||||
elseif node.name == "mario:mushroom" then
|
||||
minetest.remove_node(pos)
|
||||
mario.on_player_got_mushroom(player, 100)
|
||||
elseif node.name == "mario:strawberry" then
|
||||
minetest.remove_node(pos)
|
||||
mario.on_player_got_mushroom(player, 300)
|
||||
elseif node.name == "mario:orange" then
|
||||
minetest.remove_node(pos)
|
||||
mario.on_player_got_mushroom(player, 500)
|
||||
elseif node.name == "mario:apple" then
|
||||
minetest.remove_node(pos)
|
||||
mario.on_player_got_mushroom(player, 700)
|
||||
mario.on_player_got_mushroom(player, 15)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,6 +7,7 @@ dofile(minetest.get_modpath("mario").."/turtle.lua")
|
|||
dofile(minetest.get_modpath("mario").."/gamestate.lua")
|
||||
dofile(minetest.get_modpath("mario").."/hud.lua")
|
||||
|
||||
|
||||
minetest.register_node("mario:placer",{
|
||||
description = "Reset",
|
||||
tiles = {
|
||||
|
@ -21,17 +22,10 @@ minetest.register_node("mario:placer",{
|
|||
paramtype = "light",
|
||||
groups = {cracky = 3},
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
local schem = minetest.get_modpath("mario").."/schems/mario.mts"
|
||||
minetest.place_schematic({x=pos.x-1,y=pos.y-2,z=pos.z-2},schem,0, "air", true)
|
||||
player:setpos({x=pos.x+16,y=pos.y+0.1,z=pos.z+1})
|
||||
player:set_physics_override(1,1,0.3,true,false)
|
||||
|
||||
mario.game_start(pos, player, {
|
||||
schematic = minetest.get_modpath("mario").."/schems/mario.mts",
|
||||
scorename = "mario:classic_board",
|
||||
})
|
||||
|
||||
minetest.sound_play("mario-game-start", {pos = pos,max_hear_distance = 40,gain = 10.0,})
|
||||
end,
|
||||
})
|
||||
minetest.register_node("mario:placer2",{
|
||||
|
@ -67,9 +61,8 @@ minetest.register_node("mario:exit",{
|
|||
paramtype = "light",
|
||||
groups = {cracky = 3},
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
player:setpos({x=pos.x-5,y=pos.y+0.1,z=pos.z-3})
|
||||
print(name)
|
||||
player:set_physics_override(1,1,1,true,false)
|
||||
local game = mario.get_game_by_player(player:get_player_name())
|
||||
mario.game_end(game.id)
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
Binary file not shown.
|
@ -104,16 +104,7 @@ for i in ipairs(turtles) do
|
|||
if distance < 1.5 then
|
||||
-- player touches ghost!!
|
||||
|
||||
if gamestate.power_pellet then
|
||||
-- Player eats ghost! move it to spawn
|
||||
local ghost_spawn = vector.add(gamestate.pos, {x=13,y=0.5,z=19})
|
||||
self.object:setpos(ghost_spawn)
|
||||
-- set the timer negative so it'll have to wait extra time
|
||||
self.timer = -ghosts_death_delay
|
||||
-- play sound and reward player
|
||||
minetest.sound_play("mario_eatghost", {pos = boardcenter,max_hear_distance = 6, object=player, loop=false})
|
||||
player:get_inventory():add_item('main', 'mario:cherrys')
|
||||
else
|
||||
|
||||
-- Ghost catches the player!
|
||||
gamestate.lives = gamestate.lives - 1
|
||||
if gamestate.lives < 1 then
|
||||
|
@ -128,8 +119,10 @@ for i in ipairs(turtles) do
|
|||
minetest.chat_send_player(gamestate.player_name,"You have ".. gamestate.lives .." lives left")
|
||||
mario.game_reset(self.gameid, player)
|
||||
end
|
||||
end
|
||||
--end
|
||||
mario.update_hud(self.gameid, player)
|
||||
|
||||
|
||||
|
||||
else
|
||||
local vec = {x=p.x-s.x, y=p.y-s.y, z=p.z-s.z}
|
||||
|
|
Loading…
Reference in New Issue