|
@ -0,0 +1,52 @@
|
|||
minetest.register_node("mario:platform",{
|
||||
description = "Platform",
|
||||
tiles = {
|
||||
"mario_blue.png",
|
||||
},
|
||||
drawtype = "normal",
|
||||
paramtype = "light",
|
||||
groups = {cracky = 3},
|
||||
})
|
||||
minetest.register_node("mario:grey",{
|
||||
description = "Grey",
|
||||
tiles = {
|
||||
"mario_grey.png",
|
||||
},
|
||||
drawtype = "normal",
|
||||
paramtype = "light",
|
||||
light_source = 14,
|
||||
groups = {cracky = 3},
|
||||
})
|
||||
minetest.register_node("mario:border",{
|
||||
description = "Border",
|
||||
tiles = {
|
||||
"mario_border.png",
|
||||
},
|
||||
drawtype = "normal",
|
||||
paramtype = "light",
|
||||
groups = {cracky = 3},
|
||||
})
|
||||
minetest.register_node("mario:brick",{
|
||||
description = "Brick",
|
||||
tiles = {
|
||||
"mario_brick.png",
|
||||
},
|
||||
drawtype = "normal",
|
||||
paramtype = "light",
|
||||
groups = {cracky = 3},
|
||||
})
|
||||
minetest.register_node("mario:glass", {
|
||||
description = "Glass",
|
||||
tiles = {"mario_grey.png","mario_glass.png"},
|
||||
drawtype = "glasslike_framed",
|
||||
paramtype = "light",
|
||||
groups = {cracky = 2},
|
||||
})
|
||||
minetest.register_node("mario:coin", {
|
||||
description = "Coin",
|
||||
tiles = {"mario_coin.png"},
|
||||
drawtype = "plantlike",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
groups = {cracky = 2},
|
||||
})
|
|
@ -0,0 +1,13 @@
|
|||
The idea is to get all the coins. The turtles will walk around and if they touch you you die.
|
||||
|
||||
The turtles would only need to walk on the x axis. It starts with 2 turtles. The come out of the pipes at the top. One from each pipe. After 45 seconds? 2 more come out. A total of 4. At the bottom I placed a portal to take them to the top again so they will always be in the game.
|
||||
|
||||
After all the coins are collected the game advances to the next level. Coins reset and turtles start over. Turtles go a little faster as the levels advance.
|
||||
|
||||
When you right click on the start block the jump changes to make you jump high enough.
|
||||
|
||||
The M block in the game is an exit button. It will reset jump to normal.
|
||||
|
||||
Not exactly like the original Mario bros but it might be a fun game.
|
||||
|
||||
I did the basic set up but not sure how it would work with the api. I was studying your code but I still need to learn more to understand it.
|
|
@ -0,0 +1,66 @@
|
|||
|
||||
dofile(minetest.get_modpath("mario").."/pipes.lua")
|
||||
dofile(minetest.get_modpath("mario").."/blocks.lua")
|
||||
dofile(minetest.get_modpath("mario").."/portal.lua")
|
||||
dofile(minetest.get_modpath("mario").."/turtle.lua")
|
||||
|
||||
minetest.register_node("mario:placer",{
|
||||
description = "Reset",
|
||||
tiles = {
|
||||
"mario_border.png",
|
||||
"mario_border.png",
|
||||
"mario_border.png",
|
||||
"mario_border.png",
|
||||
"mario_border.png",
|
||||
"mario_border.png^mario_m.png",
|
||||
},
|
||||
drawtype = "normal",
|
||||
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})
|
||||
print(name)
|
||||
player:set_physics_override(1,1,0.3,true,false)
|
||||
minetest.add_entity({x=pos.x+3,y=pos.y+12,z=pos.z+1}, "mario:1")
|
||||
minetest.add_entity({x=pos.x+30,y=pos.y+12,z=pos.z+1}, "mario:1")
|
||||
end,
|
||||
})
|
||||
minetest.register_node("mario:placer2",{
|
||||
description = "Mario",
|
||||
tiles = {
|
||||
"mario_border.png",
|
||||
"mario_border.png",
|
||||
"mario_border.png",
|
||||
"mario_border.png",
|
||||
"mario_border.png",
|
||||
"mario_border.png^mario_m.png",
|
||||
},
|
||||
drawtype = "normal",
|
||||
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-1,z=pos.z-2},schem,0, "air", true)
|
||||
end,
|
||||
})
|
||||
minetest.register_node("mario:exit",{
|
||||
description = "Exit",
|
||||
tiles = {
|
||||
"mario_grey.png",
|
||||
"mario_grey.png",
|
||||
"mario_grey.png",
|
||||
"mario_grey.png",
|
||||
"mario_grey.png",
|
||||
"mario_grey.png^mario_m.png",
|
||||
},
|
||||
drawtype = "normal",
|
||||
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)
|
||||
end,
|
||||
})
|
|
@ -0,0 +1,67 @@
|
|||
local pipe_box = {
|
||||
type = "fixed",
|
||||
fixed = {{-0.375, -0.5, -0.375, 0.375, 0.5, 0.375},}}
|
||||
local pipe_elbow_box = {
|
||||
type = "fixed",
|
||||
fixed = {{-0.375, -0.5, -0.375, 0.375, 0.375, 0.375},
|
||||
{-0.375, -0.375, 0.375, 0.375, 0.375, -0.5},}}
|
||||
local pipe_end_box = {
|
||||
type = "fixed",
|
||||
fixed = {{-0.375, -0.5, -0.375, 0.375, 0.375, 0.375},
|
||||
{-0.5, 0.3125, -0.5, 0.5, 0.5, 0.5},}}
|
||||
|
||||
minetest.register_node("mario:pipe",{
|
||||
description = "Pipe",
|
||||
tiles = {
|
||||
"mario_pipe_end_sm.png",
|
||||
"mario_pipe_end_sm.png",
|
||||
"mario_pipe.png",
|
||||
"mario_pipe.png",
|
||||
"mario_pipe.png",
|
||||
"mario_pipe.png",
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky = 3},
|
||||
node_box = pipe_box,
|
||||
on_place = minetest.rotate_node,
|
||||
|
||||
})
|
||||
|
||||
minetest.register_node("mario:pipe_elbow",{
|
||||
description = "Pipe Elbow",
|
||||
tiles = {
|
||||
"mario_pipe.png",
|
||||
"mario_pipe_end_sm.png^mario_pipe_elbow_ic.png",
|
||||
"mario_pipe.png^mario_pipe_elbow.png^[transformFX",
|
||||
"mario_pipe.png^mario_pipe_elbow.png",
|
||||
"mario_pipe.png",
|
||||
"mario_pipe_end_sm.png^mario_pipe_elbow_ic.png^[transformFY",
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky = 3},
|
||||
node_box = pipe_elbow_box,
|
||||
on_place = minetest.rotate_node,
|
||||
})
|
||||
|
||||
minetest.register_node("mario:pipe_end",{
|
||||
description = "Pipe End",
|
||||
tiles = {
|
||||
"mario_pipe_end_sm.png",
|
||||
"mario_pipe_end_sm.png",
|
||||
"mario_pipe.png^mario_pipe_end_ring.png",
|
||||
"mario_pipe.png^mario_pipe_end_ring.png",
|
||||
"mario_pipe.png^mario_pipe_end_ring.png",
|
||||
"mario_pipe.png^mario_pipe_end_ring.png",
|
||||
},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky = 3},
|
||||
node_box = pipe_end_box,
|
||||
on_place = minetest.rotate_node,
|
||||
})
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
minetest.register_node("mario:portal", {
|
||||
description = "Portal",
|
||||
drawtype = "glasslike",
|
||||
tiles = {"mario_glass.png"},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
alpha = 150,
|
||||
paramtype2 = "facedir",
|
||||
walkable = false,
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 2,not_in_creative_inventory=1},
|
||||
})
|
||||
minetest.register_node("mario:portal_left", {
|
||||
description = "Portal Left",
|
||||
drawtype = "glasslike",
|
||||
tiles = {"mario_border.png"},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
paramtype2 = "facedir",
|
||||
--walkable = false,
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 2,not_in_creative_inventory=0},
|
||||
})
|
||||
minetest.register_node("mario:portal_right", {
|
||||
description = "Portal Right",
|
||||
drawtype = "glasslike",
|
||||
tiles = {"mario_border.png"},
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
paramtype2 = "facedir",
|
||||
--walkable = false,
|
||||
is_ground_content = false,
|
||||
groups = {cracky = 2,not_in_creative_inventory=0},
|
||||
})
|
||||
minetest.register_abm({
|
||||
nodenames = {"mario:portal"},
|
||||
interval = 0.5,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local objs = minetest.env:get_objects_inside_radius(pos, 1)
|
||||
for k, player in pairs(objs) do
|
||||
if player:get_player_name() then
|
||||
|
||||
player:setpos({x=pos.x,y=pos.y+12,z=pos.z})
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
minetest.register_abm({
|
||||
nodenames = {"mario:portal_left"},
|
||||
interval = 0.5,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local objs = minetest.env:get_objects_inside_radius(pos, 2)
|
||||
for k, player in pairs(objs) do
|
||||
if player:get_player_name() then
|
||||
|
||||
player:setpos({x=pos.x+31,y=pos.y+0.1,z=pos.z})
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
minetest.register_abm({
|
||||
nodenames = {"mario:portal_right"},
|
||||
interval = 0.5,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local objs = minetest.env:get_objects_inside_radius(pos, 2)
|
||||
for k, player in pairs(objs) do
|
||||
if player:get_player_name() then
|
||||
|
||||
player:setpos({x=pos.x-31,y=pos.y+0.1,z=pos.z})
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
After Width: | Height: | Size: 675 B |
After Width: | Height: | Size: 371 B |
After Width: | Height: | Size: 384 B |
After Width: | Height: | Size: 643 B |
After Width: | Height: | Size: 133 B |
After Width: | Height: | Size: 481 B |
After Width: | Height: | Size: 196 B |
After Width: | Height: | Size: 403 B |
After Width: | Height: | Size: 350 B |
After Width: | Height: | Size: 192 B |
After Width: | Height: | Size: 372 B |
After Width: | Height: | Size: 194 B |
After Width: | Height: | Size: 281 B |
After Width: | Height: | Size: 144 B |
After Width: | Height: | Size: 307 B |
|
@ -0,0 +1,147 @@
|
|||
|
||||
local ghosts_death_delay = 5
|
||||
|
||||
|
||||
local turtles = {
|
||||
{"1","Ferk"},
|
||||
{"2","Don"},
|
||||
{"3","Max"},
|
||||
{"4","Nathan"},
|
||||
}
|
||||
for i in ipairs(turtles) do
|
||||
local itm = turtles[i][1]
|
||||
local desc = turtles[i][2]
|
||||
|
||||
minetest.register_entity("mario:"..itm, {
|
||||
hp_max = 1,
|
||||
physical = true,
|
||||
collide_with_objects = true,
|
||||
visual = "sprite",
|
||||
visual_size = {x = 1, y = 1},
|
||||
textures = {
|
||||
"mario_turtle.png",
|
||||
"mario_turtle.png",
|
||||
"mario_turtle.png",
|
||||
"mario_turtle.png",
|
||||
"mario_turtle.png",
|
||||
"mario_turtle.png",
|
||||
},
|
||||
|
||||
velocity = {x=math.random(-1,1), y=0, z=math.random(-1,1)},
|
||||
collisionbox = {-0.25, -1.0, -0.25, 0.25, 0.48, 0.25},
|
||||
is_visible = true,
|
||||
automatic_rotate = true,
|
||||
automatic_face_movement_dir = -90, -- set yaw direction in degrees, false to disable
|
||||
makes_footstep_sound = false,
|
||||
|
||||
set_velocity = function(self, v)
|
||||
if not v then v = 0 end
|
||||
local yaw = self.object:getyaw()
|
||||
self.object:setvelocity({x=math.sin(yaw) * -v, y=self.object:getvelocity().y, z=math.cos(yaw) * v})
|
||||
end,
|
||||
on_step = function(self, dtime)
|
||||
-- every 1 second
|
||||
self.timer = (self.timer or 0) + dtime
|
||||
if self.timer < 1 then return end
|
||||
self.timer = 0
|
||||
--[[
|
||||
-- Do we have game state? if not just die
|
||||
local gamestate = pacmine.games[self.gameid]
|
||||
if not gamestate then
|
||||
minetest.log("action", "Removing pacman ghost without game assigned")
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
-- Make sure we are in the right state by keeping track of the reset time
|
||||
-- if the reset time changed it's likely the game got resetted while the entity wasn't loaded
|
||||
if self.last_reset then
|
||||
if self.last_reset ~= gamestate.last_reset then
|
||||
minetest.log("action", "Removing pacman ghost remaining after reset ")
|
||||
self.object:remove()
|
||||
end
|
||||
else
|
||||
self.last_reset = gamestate.last_reset
|
||||
end
|
||||
|
||||
-- Make sure we have a targetted player
|
||||
if not self.target then
|
||||
self.target = minetest.get_player_by_name(gamestate.player_name)
|
||||
end
|
||||
local player = self.target
|
||||
|
||||
-- If there's no player just stop
|
||||
if not player then
|
||||
self.set_velocity(self, 0)
|
||||
return
|
||||
end
|
||||
|
||||
local s = self.object:getpos() -- ghost
|
||||
local p = player:getpos() -- player
|
||||
|
||||
-- find distance from ghost to player
|
||||
local distance = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
|
||||
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("pacmine_eatghost", {pos = boardcenter,max_hear_distance = 6, object=player, loop=false})
|
||||
player:get_inventory():add_item('main', 'pacmine:cherrys')
|
||||
else
|
||||
-- Ghost catches the player!
|
||||
gamestate.lives = gamestate.lives - 1
|
||||
if gamestate.lives < 1 then
|
||||
minetest.chat_send_player(gamestate.player_name,"Game Over")
|
||||
pacmine.game_end(self.gameid)
|
||||
minetest.sound_play("pacmine_death", {pos = boardcenter,max_hear_distance = 20, object=player, loop=false})
|
||||
|
||||
elseif gamestate.lives == 1 then
|
||||
minetest.chat_send_player(gamestate.player_name,"This is your last life")
|
||||
pacmine.game_reset(self.gameid, player)
|
||||
else
|
||||
minetest.chat_send_player(gamestate.player_name,"You have ".. gamestate.lives .." lives left")
|
||||
pacmine.game_reset(self.gameid, player)
|
||||
end
|
||||
end
|
||||
pacmine.update_hud(self.gameid, player)
|
||||
|
||||
else
|
||||
local vec = {x=p.x-s.x, y=p.y-s.y, z=p.z-s.z}
|
||||
local yaw = (math.atan(vec.z/vec.x)+math.pi/2)
|
||||
if p.x > s.x then
|
||||
yaw = yaw + math.pi
|
||||
end
|
||||
-- face player and move backwards/forwards
|
||||
self.object:setyaw(yaw)
|
||||
if gamestate.power_pellet then
|
||||
self.set_velocity(self, -gamestate.speed) --negative velocity
|
||||
else
|
||||
self.set_velocity(self, gamestate.speed)
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
-- This function should return the saved state of the entity in a string
|
||||
get_staticdata = function(self)
|
||||
return (self.gameid or "") .. ";" .. (self.last_reset or "")
|
||||
end,
|
||||
|
||||
-- This function should load the saved state of the entity from a string
|
||||
on_activate = function(self, staticdata)
|
||||
self.object:set_armor_groups({immortal=1})
|
||||
if staticdata and staticdata ~= "" then
|
||||
local data = string.split(staticdata, ";")
|
||||
if #data == 2 then
|
||||
self.gameid = data[1]
|
||||
self.last_reset = tonumber(data[2])
|
||||
end
|
||||
end
|
||||
--]]
|
||||
end
|
||||
})
|
||||
end
|