I have been working on creating my first game, (PONG), using C++ and SDL. I have been following a tutorial online and have gotten about half way through. I am now confused from the syntax in the code which also gives me an error. I'm not aware of this use of code.
if (Contact contact = CheckPaddleCollision(ball, paddleOne)**;**
contact.type != CollisionType::None)
{
// Ball operates on its own data . ball.CollideWithPaddle/ball.velocity.x
ball.CollideWithPaddle(contact);
}
else if (contact = CheckPaddleCollision(ball, paddleTwo);
contact.type != CollisionType::None)
{
ball.CollideWithPaddle(contact);
}
I do not understand why there is a semicolon before a closing parenthesis. I really don't understand this use of code. I am used to seeing a bool after an if statement. These to if statements do not build for me ; was this a mistake in source code? Any help explaining this code with be of great help.
Source code for the program can be found here. https://code.austinmorlan.com/austin/pong/src/branch/master/Main.cpp