Jump to content
  • Advertisement
Sign in to follow this  
EvanClark

BlitzMax Collision Barrier

This topic is 2120 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
i think you will have to ask in the blitzmax forums, as your question may be too language specific :)
i don't know how many here at the forums know blitzmax, but i think seeking help in the official forums is your best bet for help

Share this post


Link to post
Share on other sites

Hello could someone send me a piece of code that when an image collides with another it stops moving


How do you think something like this would work? Well, you need to know the height and width of the images. I assume Blitzmax can provide that information once you've loaded them. Then you need to know the locations of the images on the screen. You control that, so you know where they are. Then you simply check if the X, Y and Height, Width of Image 1 overlaps the X, Y, and Height, Width of image 2, like this (pseudo-code):


bool IsCollision(Image image1, Image image2)
{
if (image1.x + image1.width < image2.x ||
image1.x > image2.x + image2.width ||
image1.y + image1.height < image2.y ||
image1.y > image2.y + image2.height) {
return false;
}
return true;
{

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!