-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathPacmanKilledGameState.lua
53 lines (45 loc) · 1.34 KB
/
PacmanKilledGameState.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
--
--------------------------------------------------------------------------------
-- FILE: PacmanKilledGameState.lua
-- USAGE: ./PacmanKilledGameState.lua
-- DESCRIPTION:
-- OPTIONS: ---
-- REQUIREMENTS: ---
-- BUGS: ---
-- NOTES: ---
-- AUTHOR: (), <>
-- COMPANY:
-- VERSION: 1.0
-- CREATED: 08/22/2011 22:48:19 CST
-- REVISION: ---
--------------------------------------------------------------------------------
--
require "State"
require "StateMachine"
PacmanKilledGameState = class( State )
function PacmanKilledGameState:init( layer )
State.init( self, "PacmanKilledGameState" )
self.layer = layer
self.gameMap = GAME_MAP
self.pacman = ENTITY_MANAGER:getEntity( PACMAN_ID )
end
function PacmanKilledGameState:enter()
GAME_TIME:pause()
self.gameMap:show( self.layer )
self.pacman:show( self.layer )
self.pacman:setDead()
backgroundMusic:stop()
pacmanDeadSound:play()
end
function PacmanKilledGameState:onUpdate()
local dyingAnim = self.pacman.animatable:getAnimation( Pacman.ANIM_DYING )
if ( dyingAnim:isDone() and not pacmanDeadSound:isPlaying() )
then
GAME_STATE_MACHINE:setCurrentState( STAGE_INTRO_GAME_STATE )
end
end
function PacmanKilledGameState:exit()
self.gameMap:hide( self.layer )
self.pacman:hide( self.layer )
end
PACMAN_KILLED_GAME_STATE = nil