ghostdeadsubstates.cpp

来自「VIGASOCO (VIdeo GAmes SOurce COde) Windo」· C++ 代码 · 共 54 行

CPP
54
字号
// 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 + =
减小字号Ctrl + -
显示快捷键?