Advertisement

breakout bricks

Started by December 23, 2021 09:46 PM
5 comments, last by Tom Sloper 2ย years, 11ย months ago

Well I have stored the bricks in vectors, I am working on how to get the ball to hit the bricks. I want to know how to do collision detection.

void drawBottomBricks()
{
	glEnable(GL_TEXTURE_2D);
	glPushMatrix();
	glBindTexture(GL_TEXTURE_2D, texture[3]);
	float br_x = -135, br_y = 55, br_x_right = -100, br_y_top = 70, br_x_width = 35, br_y_height = 15;
	vector <Brick> bricks;
	for (int i = 0; i < 8; i++)
	{
		bricks.push_back(Brick(br_x, br_y, br_x_width, br_y_height));
		br_x += br_x_width;
		br_x_right += br_x_width;
		glBegin(GL_POLYGON);
		glTexCoord3f(0.0f, 0.0f, 0.0f);
		glVertex3f(bricks[i].x, bricks[i].y + br_y_height, 0.0f);
		glTexCoord3f(1.0f, 0.0f, 0.0f);
		glVertex3f(bricks[i].x, bricks[i].y, 0.0f);
		glTexCoord3f(1.0f, 1.0f, 0.0f);
		glVertex3f(bricks[i].x + br_x_width, bricks[i].y, 0.0f);
		glTexCoord3f(0.0f, 1.0f, 0.0f);
		glVertex3f(bricks[i].x + br_x_width, bricks[i].y + br_y_height, 0.0f);
		glEnd();
	}
	glPopMatrix();
	glDisable(GL_TEXTURE_2D);
}

pbivens67 said:
I want to know how to do collision detection.

Your Snake game (February 2019) had to have collision detection, didn't it, Phil? https://gamedev.net/blogs/entry/2266700-c-console-snake-game/โ€‹

Your Pong game (June 2019) had to have collision detection, didn't it? https://gamedev.net/blogs/entry/2267467-win-32-pong/โ€‹

-- Tom Sloper -- sloperama.com

Advertisement

well I have got the collision detection to work with the ball and the paddle but I am unsure of how to do it for the bricks and the ball.

Well, how did you implement collision detection for the paddle?

MWAHAHAHAHAHAHA!!!

My Twitter Account: @EbornIan

You people are being played. Get rid of this nonsense.

https://gamedev.net/forums/topic/640150-finshed-breakout-game/5042857/?page=1

๐Ÿ™‚๐Ÿ™‚๐Ÿ™‚๐Ÿ™‚๐Ÿ™‚<โ†The tone posse, ready for action.

fleabay said:

You people are being played. Get rid of this nonsense.

https://gamedev.net/forums/topic/640150-finshed-breakout-game/5042857/?page=1

Phil did indeed say he had made Breakout back in 2013. I tried searching out his posts and didn't find that one. Thread locked.

-- Tom Sloper -- sloperama.com

This topic is closed to new replies.

Advertisement