[Change] For now we will have a static camera and limit player boundary to screen width and height.
-- Reason 1: y coord seems to bug out if we go over y600. -- Reason 2: We do not need any more than the screen width height for the initial portfolio project.
This commit is contained in:
parent
88b17ee73b
commit
3ae7e7dc17
BIN
Unuk-QT/Unuk-QT
BIN
Unuk-QT/Unuk-QT
Binary file not shown.
@ -64,7 +64,7 @@ void Player::Update(void) {
|
|||||||
AddSpeachBubble("Woot, My name is Allanis, welcome to my home. Just testing some more text to see if this works..");
|
AddSpeachBubble("Woot, My name is Allanis, welcome to my home. Just testing some more text to see if this works..");
|
||||||
|
|
||||||
// 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) {
|
||||||
|
@ -139,7 +139,7 @@ void Character::Move(void) {
|
|||||||
tileY = (int)(((y + (h / 2)) / TILE_HEIGHT));
|
tileY = (int)(((y + (h / 2)) / TILE_HEIGHT));
|
||||||
|
|
||||||
// Check collisions.
|
// Check collisions.
|
||||||
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,7 +148,7 @@ void Character::Move(void) {
|
|||||||
tileX = (int)(((x + (w / 2)) / TILE_WIDTH));
|
tileX = (int)(((x + (w / 2)) / TILE_WIDTH));
|
||||||
tileY = (int)(((y + (h / 2)) / TILE_HEIGHT));
|
tileY = (int)(((y + (h / 2)) / TILE_HEIGHT));
|
||||||
|
|
||||||
if((y < 0) || (y + h) > levelHeight) y -= yVel;
|
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;
|
||||||
|
Loading…
Reference in New Issue
Block a user