⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 character.cpp

📁 VIGASOCO (VIdeo GAmes SOurce COde) Windows port (v0.01)
💻 CPP
字号:
// Character.cpp
//
/////////////////////////////////////////////////////////////////////////////

#include "Character.h"

/////////////////////////////////////////////////////////////////////////////
// initialization and cleanup
/////////////////////////////////////////////////////////////////////////////

Character::Character()
{
}

Character::~Character()
{
}

void Character::resetState()
{
	orientation = (Orientation)0;
	posX = posY = 0;
	tilePosX = tilePosY = 0;
	movOffsX = movOffsY = 0;

	sprite = color = priority = 0;
	flipX = flipY = false;
}

/////////////////////////////////////////////////////////////////////////////
// methods
/////////////////////////////////////////////////////////////////////////////

// processes wraparound cases and return true if it has happened or it's close to happen
bool Character::checkWrapAround()
{
	// check if wraparound is going to happen on the right side
	if (tilePosX == 0x1d){
		tilePosX = 0x3d;
		return true;
	}

	// check if wraparound is going to happen on the left side
	if (tilePosX == 0x3e){
		tilePosX = 0x1e;
		return true;
	}

	// if the position is near the sides, return true
	if ((tilePosX < 0x21) || (tilePosX >= 0x3b)){
		return true;
	}

	return false;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -