Update core_2d_camera_platformer.c

This commit is contained in:
Ray 2024-01-24 21:17:11 +01:00
parent ff1eeafb95
commit 40f3df5b86
1 changed files with 5 additions and 2 deletions

View File

@ -135,6 +135,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();
@ -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;
}
}