Browse Source

Update core_2d_camera_platformer.c

pull/3759/head
Ray 11 months ago
parent
commit
40f3df5b86
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      examples/core/core_2d_camera_platformer.c

+ 5
- 2
examples/core/core_2d_camera_platformer.c 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 = mi">1;
hitObstacle = nb">true;
player->speed = 0.0f;
p->y = ei->rect.y;
break;
}
}

Loading…
Cancel
Save