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.

Recommended Posts

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

bump

Share on other sites
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 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; { 

1. 1
Rutin
24
2. 2
3. 3
JoeJ
18
4. 4
5. 5

• 38
• 23
• 13
• 13
• 17
• Forum Statistics

• Total Topics
631707
• Total Posts
3001836
×