Hi,
I made a game that i can close it by pressing X key or ESCAPE key, until this tutorial everything was good, but when i debug it and run it, I cant move the circle to left and right by pressing “A” or “D”, nothing happen by pressing these keys. please show me the way.
This is the .cpp code:
#include "raylib.h"
int main()
{
// Window layout
int width{350};
int hight{200};
InitWindow(width, hight, "Halim Shams");
SetTargetFPS(60);
while (WindowShouldClose() == false)
{
// Circle demations
int circle_x{175};
int circle_y{100};
BeginDrawing();
ClearBackground(WHITE);
DrawCircle(circle_x, circle_y, 25, BLUE);
// Game starts
if (IsKeyDown(KEY_A))
{
circle_x = circle_x - 10;
}
if (IsKeyDown(KEY_D))
{
circle_x = circle_x + 10;
}
//Game ends
EndDrawing();
}
}