Hi all,
https://github.com/joeharris200882/Pong2020
the above is a link to my Pong game, nothing fancy, really just using it as a chance to practice logic, classes etc. Can someone help me out, I think I have two main problems (maybe more, who knows)
1. The player 1 and player 2 score meters are appearing in the top left at 0, i want player one in top left, but not that high up, and player two should be over the other side of the screen.
2. I am not sure if the goalScored/gameOver conditions are all correct, It seems to end quicker than I would like (that's what she said)
Any help would be appreciated,
Joe
Help with my game? things appearing in wrong place
Re: Help with my game? things appearing in wrong place
Hello Joe,
Future Joe here,
Watch the video on constructors, then remember about the initializer list, then you will find the answer. Don't be that guy who asks a basic question without researching the answer yourself first.
Future Joe.
Future Joe here,
Watch the video on constructors, then remember about the initializer list, then you will find the answer. Don't be that guy who asks a basic question without researching the answer yourself first.
Future Joe.
-
- Posts: 44
- Joined: February 13th, 2019, 3:23 am
Re: Help with my game? things appearing in wrong place
Hi, Joelysear wrote: ↑April 22nd, 2020, 5:30 pmHi all,
https://github.com/joeharris200882/Pong2020
the above is a link to my Pong game, nothing fancy, really just using it as a chance to practice logic, classes etc. Can someone help me out, I think I have two main problems (maybe more, who knows)
1. The player 1 and player 2 score meters are appearing in the top left at 0, i want player one in top left, but not that high up, and player two should be over the other side of the screen.
2. I am not sure if the goalScored/gameOver conditions are all correct, It seems to end quicker than I would like (that's what she said)
Any help would be appreciated,
Joe
1.
If you look at VS Error List, it warns you should initialize variable.
If you don't initialize variable, the compiler will give it a random number. (Assign a random memory to variable), and things will go wrong
Code: Select all
C26495 Variable 'Player::meterHeight' is uninitialized. Always initialize a member variable (type.6).
You assign variables in InitMeter function wrong order.
Code: Select all
void Player::InitMeter(int in_meterx, int in_metery, int in_meterWidth, int in_meterHeight, Color in_c)
{
in_meterx = meterx; // it should be meterx = in_meterx;;
in_metery = metery;
in_meterWidth = meterWidth;
in_meterHeight = meterHeight;
in_c = meterc;
}