#include "bird.h" void Bird::Init() { pos = {40, float(GetScreenHeight()) / 2} ; } void Bird::Update() { downSpeed += GRAVITY; pos.y += downSpeed; CheckCollision(); } void Bird::CheckCollision() { if (pos.y - halfLength <= 0) pos.y = halfLength; if (pos.y + halfLength >= GetScreenHeight()) pos.y = GetScreenHeight() - halfLength; } void Bird::Jump() { downSpeed = 0; pos.y -= jumpSpeed; } void Bird::Draw() { DrawRectangle(pos.x - halfLength, pos.y - halfLength, halfLength * 2, halfLength * 2, DARKGREEN); }