diff --git a/source/Pacman/main.cpp b/source/Pacman/main.cpp index 2020e0c..ec038b5 100644 --- a/source/Pacman/main.cpp +++ b/source/Pacman/main.cpp @@ -3,39 +3,44 @@ int main() { InitWindow(800, 600, "Attacks for Bombs 1"); + SetTargetFPS(60); - int x = 375; - int y = 275; - int tamaño = 50; - int velocidad = 5; + float x = 375.0f; + float y = 275.0f; + float tamano = 50.0f; + float velocidad = 300.0f; while (!WindowShouldClose()) { + float dt = GetFrameTime(); + if (IsKeyDown(KEY_W)) { - y -= velocidad; + y -= velocidad * dt; } if (IsKeyDown(KEY_S)) { - y += velocidad; + y += velocidad * dt; } if (IsKeyDown(KEY_A)) { - x -= velocidad; + x -= velocidad * dt; } if (IsKeyDown(KEY_D)) { - x += velocidad; + x += velocidad * dt; } BeginDrawing(); ClearBackground(WHITE); - DrawRectangle(x, y, tamaño, tamaño, RED); + DrawRectangle((int)x, (int)y, (int)tamano, (int)tamano, RED); + + DrawFPS(10, 10); EndDrawing(); }