Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / error on the 2nd code for the collision code

Author
Message
Hellokitty100
11
Years of Service
User Offline
Joined: 3rd Apr 2012
Location:
Posted: 3rd Apr 2012 19:02
Rectangle balloonrectangle = new Rectangle((int)BalloonPos[13].X, (int)BalloonPos[13].Y, Balloon[13].Width/2, Balloon[13].Height/2);
Rectangle balloon1rectangle = new Rectangle((int)BalloonPos[10].X, (int)BalloonPos[10].Y, Balloon[10].Width / 2, Balloon[10].Height / 2);


//checking balloon K

if(balloonrectangle.Intersects(bulletrectangle))
{

bullethit = true;

}

if (bullethit == true)
{

BalloonPos[13].Y = - 500;
bullet.Y = -500;
}

////checking balloon N
if (balloon1rectangle.Intersects(bulletrectangle))
{

bullethit = true;

}

if (bullethit == true)
{

BalloonPos[10].Y = -500;
bullet.Y = -500;
}

I need help on this code which i am using the c# programme to do it.The Problem is that when i shoot the bullet to check the collision for the two separate of the collision but the problem is happen when i shoot the bullet,the two balloon which collision together disapper.
zeroSlave
14
Years of Service
User Offline
Joined: 13th Jun 2009
Location: Springfield
Posted: 4th Apr 2012 23:32 Edited at: 5th Apr 2012 03:19
This board is mostly used for 2d art. If you've got questions about programming, and more specifically, programming in C or C++, check out this board:http://forum.thegamecreators.com/?m=forum_read&i=20
Good luck, and welcome to the forums.

Could probably be written as
. You don't really need the bullethit variable. I'm not sure if other parts of your code are looking for it, but it seems like it isn't necessary.

What is the data that is stored inside of these?:


Is it possible that the information is the same for different positions in the array?

For example:


That would make them all disappear.

Login to post a reply

Server time is: 2024-03-29 02:13:34
Your offset time is: 2024-03-29 02:13:34