Axe Game Circle no longer moving

I got to the last part of the Axe game and after setting up to update the collison_with_axe and the postins the KEY_D no loner moves the circle.

#include "raylib.h"

int main()
{
    //int screenY = GetMonitorWidth(1);
    //int screenX =  GetMonitorHeight(1);  

    //Window Dimensions
    int width{800};
    int height{450};
    

    //Circle Coord
    int circle_x{200};
    int circle_y{200};
    int circle_radius{25};
    //Circle Edges
    int l_circle_x{circle_x - circle_radius};
    int r_circle_x{circle_x + circle_radius};
    int u_circle_y{circle_y - circle_radius};
    int b_circle_y{circle_y + circle_radius};

    //Axe
    int axe_x{400};
    int axe_y{0};
    int axe_length{50};
    int direction{10};
    //Axe Edges
    int l_axe_x{axe_x};
    int r_axe_x{axe_x + axe_length};
    int u_axe_y{axe_y};
    int b_axe_y{axe_y + axe_length};

    bool collision_with_axe = 
            (b_axe_y >= u_circle_y) && 
            (u_axe_y <= b_circle_y) && 
            (r_axe_x >= l_circle_x) && 
            (l_axe_x <= r_circle_x);

    InitWindow(width,height,"Axe Game");
    SetTargetFPS(60);

    while (WindowShouldClose() == false)
    {
        BeginDrawing();
        ClearBackground(WHITE);

        if (collision_with_axe)
        {
            DrawText("Game Over!", 400, 200, 20, RED);
        }
        else
        {
            //Game logic begins

            //Update Edges
            l_circle_x = circle_x = circle_radius;
            r_circle_x = circle_x + circle_radius;
            u_circle_y = circle_y - circle_radius;
            b_circle_y = circle_y + circle_radius;

            l_axe_x = axe_x;
            r_axe_x = axe_x + axe_length;
            u_axe_y = axe_y;
            b_axe_y = axe_y + axe_length;
            //Update clollison
            collision_with_axe = 
                (b_axe_y >= u_circle_y) && 
                (u_axe_y <= b_circle_y) && 
                (r_axe_x >= l_circle_x) && 
                (l_axe_x <= r_circle_x);

            DrawCircle(circle_x,circle_y,circle_radius,BLUE);
            DrawRectangle(axe_x,axe_y,axe_length,axe_length,RED);

            //Move Axe
            axe_y += direction;
            if (axe_y > height || axe_y < 0)
            {
                direction = -direction;
            }

            if (IsKeyDown(KEY_D) && circle_x < width) 
            {
                circle_x += 10;
            }
            else if (IsKeyDown(KEY_A) && circle_x > 0)
            {
                circle_x -= 10;
            }

            //Game Logic Ends
            
        }
        EndDrawing();
       
    }
}

It was an = not a - I got it fixed

Good working finding the solution!

Thanks stupid fat finger typos. They’ll getcha every time. Lol

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms