summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonBatman <serfdon@gmail.com>2015-10-26 12:48:12 -0700
committerDonBatman <serfdon@gmail.com>2015-10-26 12:48:12 -0700
commita9b9c4a94d8c4da128284b3de7626b7078680514 (patch)
tree9b41be76f41a843feae53e313688c985b0719513
parenta593cc543219453baee971860072d286f4c2c24c (diff)
new pacmine schems
added mario
-rw-r--r--mario/blocks.lua52
-rw-r--r--mario/game_play.txt13
-rw-r--r--mario/init.lua66
-rw-r--r--mario/pipes.lua67
-rw-r--r--mario/portal.lua76
-rw-r--r--mario/schems/mario.mtsbin0 -> 544 bytes
-rw-r--r--mario/textures/mario_blue.pngbin0 -> 675 bytes
-rw-r--r--mario/textures/mario_border.pngbin0 -> 371 bytes
-rw-r--r--mario/textures/mario_brick.pngbin0 -> 384 bytes
-rw-r--r--mario/textures/mario_coin.pngbin0 -> 643 bytes
-rw-r--r--mario/textures/mario_glass.pngbin0 -> 133 bytes
-rw-r--r--mario/textures/mario_grey.pngbin0 -> 481 bytes
-rw-r--r--mario/textures/mario_m.pngbin0 -> 196 bytes
-rw-r--r--mario/textures/mario_pipe.pngbin0 -> 403 bytes
-rw-r--r--mario/textures/mario_pipe_elbow.pngbin0 -> 350 bytes
-rw-r--r--mario/textures/mario_pipe_elbow_ic.pngbin0 -> 192 bytes
-rw-r--r--mario/textures/mario_pipe_end.pngbin0 -> 372 bytes
-rw-r--r--mario/textures/mario_pipe_end_ring.pngbin0 -> 194 bytes
-rw-r--r--mario/textures/mario_pipe_end_sm.pngbin0 -> 281 bytes
-rw-r--r--mario/textures/mario_portal.pngbin0 -> 144 bytes
-rw-r--r--mario/textures/mario_turtle.pngbin0 -> 307 bytes
-rw-r--r--mario/turtle.lua147
-rw-r--r--pacmine/schems/pacmine.mtsbin1144 -> 1151 bytes
-rw-r--r--pacmine/schems/pacmine_3.mtsbin1156 -> 0 bytes
-rw-r--r--pacmine/schems/pacmini.mtsbin534 -> 539 bytes
25 files changed, 421 insertions, 0 deletions
diff --git a/mario/blocks.lua b/mario/blocks.lua
new file mode 100644
index 0000000..a800526
--- /dev/null
+++ b/mario/blocks.lua
@@ -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},
+})
diff --git a/mario/game_play.txt b/mario/game_play.txt
new file mode 100644
index 0000000..9bf60fc
--- /dev/null
+++ b/mario/game_play.txt
@@ -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.
diff --git a/mario/init.lua b/mario/init.lua
new file mode 100644
index 0000000..328f346
--- /dev/null
+++ b/mario/init.lua
@@ -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,
+})
diff --git a/mario/pipes.lua b/mario/pipes.lua
new file mode 100644
index 0000000..3cfb04f
--- /dev/null
+++ b/mario/pipes.lua
@@ -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,
+})
+
diff --git a/mario/portal.lua b/mario/portal.lua
new file mode 100644
index 0000000..1c61d8d
--- /dev/null
+++ b/mario/portal.lua
@@ -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
+})
diff --git a/mario/schems/mario.mts b/mario/schems/mario.mts
new file mode 100644
index 0000000..182c610
--- /dev/null
+++ b/mario/schems/mario.mts
Binary files differ
diff --git a/mario/textures/mario_blue.png b/mario/textures/mario_blue.png
new file mode 100644
index 0000000..6e135a0
--- /dev/null
+++ b/mario/textures/mario_blue.png
Binary files differ
diff --git a/mario/textures/mario_border.png b/mario/textures/mario_border.png
new file mode 100644
index 0000000..ef4bcc9
--- /dev/null
+++ b/mario/textures/mario_border.png
Binary files differ
diff --git a/mario/textures/mario_brick.png b/mario/textures/mario_brick.png
new file mode 100644
index 0000000..f74e35c
--- /dev/null
+++ b/mario/textures/mario_brick.png
Binary files differ
diff --git a/mario/textures/mario_coin.png b/mario/textures/mario_coin.png
new file mode 100644
index 0000000..9696b27
--- /dev/null
+++ b/mario/textures/mario_coin.png
Binary files differ
diff --git a/mario/textures/mario_glass.png b/mario/textures/mario_glass.png
new file mode 100644
index 0000000..c0edad2
--- /dev/null
+++ b/mario/textures/mario_glass.png
Binary files differ
diff --git a/mario/textures/mario_grey.png b/mario/textures/mario_grey.png
new file mode 100644
index 0000000..4be435a
--- /dev/null
+++ b/mario/textures/mario_grey.png
Binary files differ
diff --git a/mario/textures/mario_m.png b/mario/textures/mario_m.png
new file mode 100644
index 0000000..ce4963a
--- /dev/null
+++ b/mario/textures/mario_m.png
Binary files differ
diff --git a/mario/textures/mario_pipe.png b/mario/textures/mario_pipe.png
new file mode 100644
index 0000000..54c6aed
--- /dev/null
+++ b/mario/textures/mario_pipe.png
Binary files differ
diff --git a/mario/textures/mario_pipe_elbow.png b/mario/textures/mario_pipe_elbow.png
new file mode 100644
index 0000000..994e2b5
--- /dev/null
+++ b/mario/textures/mario_pipe_elbow.png
Binary files differ
diff --git a/mario/textures/mario_pipe_elbow_ic.png b/mario/textures/mario_pipe_elbow_ic.png
new file mode 100644
index 0000000..9b2daa6
--- /dev/null
+++ b/mario/textures/mario_pipe_elbow_ic.png
Binary files differ
diff --git a/mario/textures/mario_pipe_end.png b/mario/textures/mario_pipe_end.png
new file mode 100644
index 0000000..b29a3a7
--- /dev/null
+++ b/mario/textures/mario_pipe_end.png
Binary files differ
diff --git a/mario/textures/mario_pipe_end_ring.png b/mario/textures/mario_pipe_end_ring.png
new file mode 100644
index 0000000..ce90035
--- /dev/null
+++ b/mario/textures/mario_pipe_end_ring.png
Binary files differ
diff --git a/mario/textures/mario_pipe_end_sm.png b/mario/textures/mario_pipe_end_sm.png
new file mode 100644
index 0000000..e80bad1
--- /dev/null
+++ b/mario/textures/mario_pipe_end_sm.png
Binary files differ
diff --git a/mario/textures/mario_portal.png b/mario/textures/mario_portal.png
new file mode 100644
index 0000000..7015ca5
--- /dev/null
+++ b/mario/textures/mario_portal.png
Binary files differ
diff --git a/mario/textures/mario_turtle.png b/mario/textures/mario_turtle.png
new file mode 100644
index 0000000..15f160e
--- /dev/null
+++ b/mario/textures/mario_turtle.png
Binary files differ
diff --git a/mario/turtle.lua b/mario/turtle.lua
new file mode 100644
index 0000000..d7d0967
--- /dev/null
+++ b/mario/turtle.lua
@@ -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
diff --git a/pacmine/schems/pacmine.mts b/pacmine/schems/pacmine.mts
index 98fe69b..d85cb18 100644
--- a/pacmine/schems/pacmine.mts
+++ b/pacmine/schems/pacmine.mts
Binary files differ
diff --git a/pacmine/schems/pacmine_3.mts b/pacmine/schems/pacmine_3.mts
deleted file mode 100644
index a3124f9..0000000
--- a/pacmine/schems/pacmine_3.mts
+++ /dev/null
Binary files differ
diff --git a/pacmine/schems/pacmini.mts b/pacmine/schems/pacmini.mts
index 43be871..7a30261 100644
--- a/pacmine/schems/pacmini.mts
+++ b/pacmine/schems/pacmini.mts
Binary files differ