mirror of
https://github.com/raysan5/raylib.git
synced 2026-02-08 07:09:18 -05:00
Refactor removing extra space and add break line for { (#5533)
Co-authored-by: maiconpintoabreu <maicon@thinkpad02.exads.com>
This commit is contained in:
@ -139,14 +139,14 @@ int main(void)
|
||||
Ball *ball = &balls[i];
|
||||
|
||||
// The ball is not grabbed
|
||||
if (!ball->grabbed)
|
||||
if (!ball->grabbed)
|
||||
{
|
||||
// Ball repositioning using the velocity
|
||||
ball->pos.x += ball->vel.x * delta;
|
||||
ball->pos.y += ball->vel.y * delta;
|
||||
|
||||
// Does the ball hit the screen right boundary?
|
||||
if ((ball->pos.x + ball->radius) >= screenWidth)
|
||||
if ((ball->pos.x + ball->radius) >= screenWidth)
|
||||
{
|
||||
ball->pos.x = screenWidth - ball->radius; // Ball repositioning
|
||||
ball->vel.x = -ball->vel.x*ball->elasticity; // Elasticity makes the ball lose 10% of its velocity on hit
|
||||
@ -159,12 +159,12 @@ int main(void)
|
||||
}
|
||||
|
||||
// The same for y axis
|
||||
if ((ball->pos.y + ball->radius) >= screenHeight)
|
||||
if ((ball->pos.y + ball->radius) >= screenHeight)
|
||||
{
|
||||
ball->pos.y = screenHeight - ball->radius;
|
||||
ball->vel.y = -ball->vel.y*ball->elasticity;
|
||||
}
|
||||
else if ((ball->pos.y - ball->radius) <= 0)
|
||||
else if ((ball->pos.y - ball->radius) <= 0)
|
||||
{
|
||||
ball->pos.y = ball->radius;
|
||||
ball->vel.y = -ball->vel.y*ball->elasticity;
|
||||
|
||||
Reference in New Issue
Block a user