Update core_2d_camera_platformer.c
This commit is contained in:
parent
ff1eeafb95
commit
40f3df5b86
1 changed files with 5 additions and 2 deletions
|
@ -136,6 +136,8 @@ int main(void)
|
|||
Rectangle playerRect = { player.position.x - 20, player.position.y - 40, 40, 40 };
|
||||
DrawRectangleRec(playerRect, RED);
|
||||
|
||||
DrawCircle(player.position.x, player.position.y, 5, GOLD);
|
||||
|
||||
EndMode2D();
|
||||
|
||||
DrawText("Controls:", 20, 20, 10, BLACK);
|
||||
|
@ -168,7 +170,7 @@ void UpdatePlayer(Player *player, EnvItem *envItems, int envItemsLength, float d
|
|||
player->canJump = false;
|
||||
}
|
||||
|
||||
int hitObstacle = 0;
|
||||
bool hitObstacle = false;
|
||||
for (int i = 0; i < envItemsLength; i++)
|
||||
{
|
||||
EnvItem *ei = envItems + i;
|
||||
|
@ -179,9 +181,10 @@ void UpdatePlayer(Player *player, EnvItem *envItems, int envItemsLength, float d
|
|||
ei->rect.y >= p->y &&
|
||||
ei->rect.y <= p->y + player->speed*delta)
|
||||
{
|
||||
hitObstacle = 1;
|
||||
hitObstacle = true;
|
||||
player->speed = 0.0f;
|
||||
p->y = ei->rect.y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue