Hello,
I am trying to get the point counter to increment when the user clicks on a ball using the mouse. I'm using the Raylib library. I have posted a snippet of my code. I can post if more is needed.
Vector2 mp = GetMousePosition();
RedBall.X_Pos = static_cast <float> (rand() % Width / 2);
RedBall.Y_Pos = static_cast <float> (rand() % Height / 2);
RedBall.X_Vel = 8.0f;
RedBall.Y_Vel = 8.0f;
RedBall.Pos = { RedBall.X_Pos,RedBall.Y_Pos };
RedBall.Vel = { RedBall.X_Vel,RedBall.Y_Vel };
RedBall.Pos.x += RedBall.Vel.x;
RedBall.Pos.y += RedBall.Vel.y;
if ((RedBall.Pos.x >= (GetScreenWidth() - RedBall.Radius)) || (RedBall.Pos.x <= RedBall.Radius)) RedBall.Vel.x *= -1.0f;
if ((RedBall.Pos.y >= (GetScreenHeight() - RedBall.Radius)) || (RedBall.Pos.y <= RedBall.Radius)) RedBall.Vel.y *= -1.0f;
//problem with collision detecting?
if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON) && CheckCollisionPointCircle(RedBall.Pos,mp,RedBall.Radius))
{
Player.Current_Game_Score++; //does not increment
}
DrawCircleV(RedBall.Pos, RedBall.Radius, RED);