📄 ghostdeadsubstates.cpp
字号:
// GhostDeadSubstates.cpp
//
/////////////////////////////////////////////////////////////////////////////
#include "GhostDeadSubstates.h"
#include "Ghost.h"
#include "Pacman.h"
#include "Task.h"
#include "Game.h"
void GhostInitKillSubstate::run()
{
// index to sprite number for points per this kill
int ghost = theGame->collisionObject - 1;
// set sprite number and color entry for the ghost
theGame->ghost[ghost]->sprite = 0x27 + theGame->currentKills;
theGame->ghost[ghost]->color = 0x18;
// hide pacman changing it's color entry
theGame->pacman->color = 0x00;
// schedules a ghost dead anim substate change in a second
theScheduler->addScheduledTask(new Task(3, Task::TEN_HUNDREDTHS, 10));
// changes to the next ghost dead anim substate
theGame->ghostDeadAnimState++;
}
void GhostDeadNopSubstate::run()
{
// nop
}
void GhostEndKillSubstate::run()
{
// index to sprite number for points per this kill
int ghost = theGame->collisionObject - 1;
// set ghost sprite number
theGame->ghost[ghost]->sprite = 0x20;
// show pacman again changing it's color entry
theGame->pacman->color = 0x09;
// set a flag to change ghost state to dead
theGame->killingGhostState = theGame->collisionObject;
// set this collision as handled and reset state
theGame->collisionObject = 0;
theGame->ghostDeadAnimState = 0;
// TODOSOUND: set ghost going home sound in channel 1
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -