is it possible to make collisions using frames?

BlitzPlus Forums/BlitzPlus Beginners Area/is it possible to make collisions using frames?

Ice T.(Posted 2006) [#1]
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.


Andres(Posted 2006) [#2]
ImagesCollide (image1,x1,y1,frame1,image2,x2,y2,frame2)

frame1, frame2 should be always what's beeing drawed currently.


Ice T.(Posted 2006) [#3]
thanks!


Réno(Posted 2006) [#4]
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 ;)


Ice T.(Posted 2006) [#5]
could you explain it a little more?


Adam Novagen(Posted 2006) [#6]
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.


Ice T.(Posted 2006) [#7]
thanks ADAM (The Gigamaster), I understand it now
=D


Réno(Posted 2006) [#8]
Yes, no pixel perfect, but it's fine for me ;)

IceT, I could make a drawing if you want to see how it works.


Ice T.(Posted 2006) [#9]
okay, I'd like that


Réno(Posted 2006) [#10]
Now loading...


Adam Novagen(Posted 2006) [#11]
Glad I could help, Ice T.! Blitz rules!!!


Réno(Posted 2006) [#12]
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...

:\


Ice T.(Posted 2006) [#13]
okay, thats fine


Réno(Posted 2006) [#14]
Hi,

I hope you'll understand something ;)

These are the basics. You should use DIM or MID$ to keep all informations for each frame.




Adam Novagen(Posted 2006) [#15]
Woah. That guy is ugly. Like... Scary ugly. I like it! ^_^