[Change] SetCamera() is called once again.

This commit is contained in:
Rtch90 2011-12-28 22:41:39 +00:00
parent 73210e0451
commit 3533f5c607
3 changed files with 5 additions and 8 deletions

Binary file not shown.

View File

@ -8,7 +8,7 @@ Player::Player(Map *mapArg) : Character(mapArg) {
} }
Player::~Player(void) { Player::~Player(void) {
\
} }
void Player::HandleInput(void) { void Player::HandleInput(void) {
@ -60,7 +60,7 @@ void Player::Update(void) {
AddSpeachBubble("Woot, My name is Allanis, welcome to my home"); AddSpeachBubble("Woot, My name is Allanis, welcome to my home");
// For now The camera will be static. // For now The camera will be static.
//SetCamera(); SetCamera();
} }
void Player::SetName(string nameArg) { void Player::SetName(string nameArg) {

View File

@ -137,9 +137,8 @@ void Character::Move(void) {
tileX = ((x + (w / 2)) / TILE_WIDTH); tileX = ((x + (w / 2)) / TILE_WIDTH);
tileY = ((y + (h / 2)) / TILE_HEIGHT); tileY = ((y + (h / 2)) / TILE_HEIGHT);
// While we have a static camera, ensure that we do not go out // Check collisions.
// of the camera boundaries. if((x < 0) || (x + w) > levelWidth) x -= xVel;
if((x < 0) || (x + w) > levelWidth || (x + w) > SCREEN_WIDTH) x -= xVel;
if(CheckTileCollisions()) x -= xVel; if(CheckTileCollisions()) x -= xVel;
if(CheckEntityCollisions()) x -= xVel; if(CheckEntityCollisions()) x -= xVel;
//if(CheckCharacterCollisions()) x -= xVel; //if(CheckCharacterCollisions()) x -= xVel;
@ -148,9 +147,7 @@ void Character::Move(void) {
tileX = ((x + (w / 2)) / TILE_WIDTH); tileX = ((x + (w / 2)) / TILE_WIDTH);
tileY = ((y + (h / 2)) / TILE_HEIGHT); tileY = ((y + (h / 2)) / TILE_HEIGHT);
// While we have a static camera, ensure that we do not go out if((y < 0) || (y + h) > levelHeight) y -= yVel;
// of the camera boundaries.
if((y < 0) || (y + h) > levelHeight || (y + h) > SCREEN_HEIGHT) y -= yVel;
if(CheckTileCollisions()) y -= yVel; if(CheckTileCollisions()) y -= yVel;
if(CheckEntityCollisions()) y -= yVel; if(CheckEntityCollisions()) y -= yVel;
if(CheckCharacterCollisions()) y -= yVel; if(CheckCharacterCollisions()) y -= yVel;