Working on Collisions
This commit is contained in:
@@ -121,7 +121,8 @@ void Game::init(const char *title, int width, int height, bool fullscreen, int g
|
||||
|
||||
map = new Map("terrain",globalScale,16);
|
||||
|
||||
std::string myText = "Find lost puppies!\nThey need your help!";
|
||||
// std::string myText = "Find lost puppies!\nThey need your help!";
|
||||
std::string myText = "Press U to Start";
|
||||
|
||||
text = new UIText(myText, "font", 0, 0, 8, 12, globalScale);
|
||||
text->ParseString(myText, 12, 22, globalScale, "text");
|
||||
@@ -230,7 +231,9 @@ void Game::update()
|
||||
SDL_Rect cCol = c->getComponent<ColliderComponent>().collider;
|
||||
if(Collision::AABB(cCol, playerCol))
|
||||
{
|
||||
// printf("Collision detected!\nplayerIsGrounded:%d if 0: idle plays\n",playerIsGrounded);
|
||||
// printDebug("Collision Detected");
|
||||
// printf("Collision Stats:\nPlayer Center\nx: %d\ny: %d\nObjectCollider Center\nx: %d\ny: %d\n",(playerCol.x+playerCol.w/2)/gScale,(playerCol.y+playerCol.h/2)/gScale,(cCol.x+cCol.w/2)/gScale,(cCol.y+cCol.h/2)/gScale);
|
||||
// printDebug("");
|
||||
if(!playerIsGrounded){
|
||||
player.getComponent<SpriteComponent>().Play("Idle");
|
||||
}
|
||||
@@ -324,10 +327,16 @@ void Game::clean()
|
||||
printf("Game Cleaned\n");
|
||||
}
|
||||
|
||||
void Game::printDebug(char* debugInfo)
|
||||
std::string previousMessage = "";
|
||||
|
||||
void Game::printDebug(std::string debugInfo)
|
||||
{
|
||||
printf("%s",debugInfo);
|
||||
printf("\n");
|
||||
if (previousMessage != debugInfo)
|
||||
{
|
||||
std::cout << debugInfo;
|
||||
printf("\n");
|
||||
}
|
||||
previousMessage = debugInfo;
|
||||
}
|
||||
|
||||
void Game::drawLine(Vector2D srcpt, Vector2D destpt, int red, int green, int blue)
|
||||
|
||||
Reference in New Issue
Block a user