unary op bugfix

This commit is contained in:
nub31
2025-09-28 23:13:07 +02:00
parent 268a9ac474
commit 2ac16e6aa7
2 changed files with 25 additions and 12 deletions

View File

@@ -28,14 +28,21 @@ extern "main" func main(args: []cstring): i64
}
raylib::EndDrawing()
if x + width >= raylib::GetScreenWidth() || x <= 0
if x <= 0
{
direction.x = -direction.x
direction.x = 1
}
if y + height >= raylib::GetScreenHeight() || y <= 0
else if x + width >= raylib::GetScreenWidth()
{
direction.y = -direction.y
direction.x = -1
}
else if y <= 0
{
direction.y = 1
}
else if y + height >= raylib::GetScreenHeight()
{
direction.y = -1
}
x = x + @floatToInt(i32, direction.x)