summaryrefslogtreecommitdiff
path: root/gamestate.lua
diff options
context:
space:
mode:
authorDonBatman <serfdon@gmail.com>2015-10-22 09:25:40 -0700
committerDonBatman <serfdon@gmail.com>2015-10-22 09:25:40 -0700
commitf8e75176876652333b376398d982ad06ac26b66f (patch)
tree5dc85a8e0640c685507e7ff761a5132029f1c2d9 /gamestate.lua
parent834797777bbd6c2510742885a192987fdbfb3d79 (diff)
Added score to table. Changed craft items to nodes. Changed sounds. Changed blocks to immortal
Diffstat (limited to 'gamestate.lua')
-rwxr-xr-xgamestate.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/gamestate.lua b/gamestate.lua
index 476590a..fd073e0 100755
--- a/gamestate.lua
+++ b/gamestate.lua
@@ -28,6 +28,7 @@ function mypacman.game_start(pos, player)
level = 1,
speed = 2,
lives = 3,
+ score = 0,
}
mypacman.games[id] = gamestate
minetest.log("action","New pacman game started at " .. id .. " by " .. gamestate.player_name)
@@ -115,7 +116,9 @@ function mypacman.on_player_got_pellet(player)
if not gamestate then return end
gamestate.pellet_count = gamestate.pellet_count + 1
- if gamestate.pellet_count >= 20 then -- 252
+ gamestate.score = gamestate.score + 10
+ minetest.chat_send_player(name, "Your score is "..gamestate.score)
+ if gamestate.pellet_count >= 252 then -- 252
minetest.chat_send_player(name, "You cleared the board!")
mypacman.remove_ghosts(gamestate.id)
@@ -144,9 +147,11 @@ function mypacman.on_player_got_power_pellet(player)
minetest.chat_send_player(name, "You got a POWER PELLET")
gamestate.power_pellet = os.time() + power_pellet_duration
+ gamestate.score = gamestate.score + 50
+ minetest.chat_send_player(name, "Your score is "..gamestate.score)
local boardcenter = vector.add(gamestate.pos, {x=13,y=0.5,z=15})
- local powersound = minetest.sound_play("mypacman_beginning", {pos = boardcenter,max_hear_distance = 20, object=player, loop=true})
+ local powersound = minetest.sound_play("mypacman_powerup", {pos = boardcenter,max_hear_distance = 20, object=player, loop=true})
minetest.after(power_pellet_duration, function()
if os.time() >= (gamestate.power_pellet or 0) then