TileMaps and camera tuning
This commit is contained in:
@ -43,20 +43,24 @@ public:
|
||||
{
|
||||
case SDLK_UP:
|
||||
if(Game::gsm->currentState == GameStateManager::ST_COREGAME){
|
||||
if(transform->position.y>0){
|
||||
transform->velocity.y = -1;
|
||||
// if(Game::playerIsGrounded){
|
||||
sprite->Play("Walk");
|
||||
// }
|
||||
sprite->spriteFlip = SDL_FLIP_NONE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SDLK_DOWN:
|
||||
if(Game::gsm->currentState == GameStateManager::ST_COREGAME){
|
||||
if(transform->position.y<Game::levelMap.h){
|
||||
transform->velocity.y = 1;
|
||||
// if(Game::playerIsGrounded){
|
||||
sprite->Play("Walk");
|
||||
// }
|
||||
sprite->spriteFlip = SDL_FLIP_NONE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SDLK_LEFT:
|
||||
@ -69,11 +73,13 @@ public:
|
||||
// }
|
||||
// transform->lastSafePos = Vector2D(transform->position.x,transform->position.y);
|
||||
// printf("lastSafePos .x: %g .y: %g \n",transform->lastSafePos.x,transform->lastSafePos.y);
|
||||
if(transform->position.x>0){
|
||||
transform->velocity.x = -1;
|
||||
// if(Game::playerIsGrounded){
|
||||
sprite->Play("Walk");
|
||||
// }
|
||||
sprite->spriteFlip = SDL_FLIP_NONE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SDLK_RIGHT:
|
||||
@ -85,11 +91,13 @@ public:
|
||||
// Do a pre-check for tile-based smooth algorithm
|
||||
// =========
|
||||
// int intersectionTileX = collider->center.x;
|
||||
if(transform->position.x<Game::levelMap.w){
|
||||
transform->velocity.x = 1;
|
||||
// if(Game::playerIsGrounded){
|
||||
sprite->Play("Walk");
|
||||
// }
|
||||
sprite->spriteFlip = SDL_FLIP_HORIZONTAL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
// case SDLK_a:
|
||||
|
Reference in New Issue
Block a user