Jump to content

View more

Image of the Day

The beast has a mighty searchlight of evil! #screenshotsaturday https://t.co/bzKepOojDL
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

breakout game

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
20 replies to this topic

#21 phil67rpg   Members   

409
Like
0Likes
Like

Posted 29 November 2012 - 08:09 PM

well now comes the hard part. I am now using the following code to detect ball and brick collision detection. The error I am getting is that the ball quickly disappears on the screen when I run the program. I have done a great deal of research on this topic but I still need some help.
void brick_collision()
{
	if(x>3.0f && x<5.0f)
	{
	brick=3.0f;
	bricks[3][5]=false;
	}

	else if(x>1.0f && x<3.0f)
	{
	brick=1.0f;
	bricks[3][4]=false;
	}
	
	else if(x>-1.0f && x<1.0f)
	{
	brick=-1.0f;
	bricks[3][3]=false;
	}
	
	else if(x>-3.0f && x<-1.0f)
	{
	brick=-3.0f;
	bricks[3][2]=false;
	}
	
	else if(x>-5.0f && x<-3.0f)
	{
	brick=-5.0f;
	bricks[3][1]=false;
	}
	
	SPRITE object3;
	SPRITE object4;
	
	object3.x=x;
	object3.y=y;
	object3.width=0.1f;
	object3.height=0.1f;

	object4.x=brick;
	object4.y=3.5f;
	object4.width=2.0f;
	object4.height=1.0f;

	if(Sprite_Collide(&object3,&object4)==1)
	{
	xstep=-xstep;
	ystep=-ystep;
	}
}
I will do more research on collision detection.




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.