is it possible to make collisions using frames?
BlitzPlus Forums/BlitzPlus Beginners Area/is it possible to make collisions using frames?
| ||
say you have a boss for an action game, he then raches back his arm and gives you a punch that sends you flying. if you have all of the bosses frames on one strip, how do make it so that if you collide within 3 frames of the punch you take damage? I also want this to affect your player to so that if you press a key he/she may punch, kick,etc. |
| ||
ImagesCollide (image1,x1,y1,frame1,image2,x2,y2,frame2) frame1, frame2 should be always what's beeing drawed currently. |
| ||
thanks! |
| ||
Use rectsoverlap, very much faster ! Make Dim infos for box for each frame : xy from the origin of the frame + xy for the size of the box. Make box for impact damage ( head, body, etc ), for hit impact ( puch, etc ), or anything you want ;) |
| ||
could you explain it a little more? |
| ||
The method he's suggesting creates an invisible "collision rectangle" in two locations, with user-specified width & height. Blitz then tests to see if those rectangles overlap, and returns True if they do. One problem with Reno's suggestion is that the collisions aren't pixel-perfect, unless your characters are made out of squares. ;) For instance, say you wanted to test if two circles were colliding. Using RectsOverLap() would be a bad idea, since the rectangles' corners would extend beyond the circles, allowing them to "collide" when they really weren't! It is a faster solution, just less accurate. It really depends on how well a rectangle fits your images, and how "tight" you want your collision checking to be. |
| ||
thanks ADAM (The Gigamaster), I understand it now =D |
| ||
Yes, no pixel perfect, but it's fine for me ;) IceT, I could make a drawing if you want to see how it works. |
| ||
okay, I'd like that |
| ||
Now loading... |
| ||
Glad I could help, Ice T.! Blitz rules!!! |
| ||
Hi Ice T., Sorry, but I have big problems with my internet connection at home. I can only use internet from work. I will try to put a picture in the next days... be patient... :\ |
| ||
okay, thats fine |
| ||
Hi, I hope you'll understand something ;) These are the basics. You should use DIM or MID$ to keep all informations for each frame. ![]() |
| ||
Woah. That guy is ugly. Like... Scary ugly. I like it! ^_^ |