English Amiga Board

English Amiga Board (http://eab.abime.net/index.php)
-   Coders. AMOS (http://eab.abime.net/forumdisplay.php?f=119)
-   -   Writing custom collision code advice (http://eab.abime.net/showthread.php?t=88713)

Brick Nash 21 September 2017 22:12

Writing custom collision code advice
 
Just want an opinion to see if this is worth pursuing.

I've got my Double Dragon port running nicely now and I have an enemy who follows my player around the screen and it's all animated using my own custom animation player.

I'm about to get into the combat and I was thinking that the built in bob collisions might not be very good as for a beat em up as you only want a hit to be registered when a certain piece of say, an arm, meets an enemies upper body and not the whole bob.

I had the idea of drawing boxes when the player punches to get an idea of coordinates which I could use for a punch hitbox. Amos will draw a box around the place where I want the collision to go, then do the same for the enemy's upper body.

I'd then take those coordinates and code in that if the enemy's body box enters the coordinates of the punch box on the exact frame of the punch then that's a hit.

It's only theory so far and I think it'll be a lot of work, but I've tried the box drawing and it really works to get a visual on the numbers.

Do you think this is worth pursuing? I thought about having an invisible collision object but I'd like to limit the amount of stuff going on in the screen as at the moment the game only runs smoothly with a 68020.

Thanks, any advice will be welcome! :)

idrougge 22 September 2017 14:47

You don't really need to draw the boxes, all that arithmetic can be done without actually touching the screen.

Another option is to split your bobs into two parts: the one giving damage and the one receiving damage.

OmegaMax 22 September 2017 14:54

Quote:

Originally Posted by idrougge (Post 1186553)
You don't really need to draw the boxes, all that arithmetic can be done without actually touching the screen.

The above answer is correct,have a look at bounding box collision on google.

Brick Nash 22 September 2017 23:14

I know I don't need to, but it just helps me get a quick visual to where I want the co-ordinates to be. I don't actually use the drawn boxes. I'm pretty bad at maths anyway.

When you say split the bob into two parts do you mean use two bobs? One for the main player and one simply the collisions?

Cylon 23 September 2017 01:40

You can split your player into active and passive parts (bob numbers), then check only punch (from active) bob > hit (to passive) opponent body part bob.
Or, make masks (bmaps) (with different colours/bitplanes used for every body part) of every players animation frame and check those mask-bmaps for collisions.

idrougge 23 September 2017 04:27

Quote:

Originally Posted by Brick Nash (Post 1186653)
When you say split the bob into two parts do you mean use two bobs? One for the main player and one simply the collisions?

Yes, just another bob for the fist/foot.

Brick Nash 23 September 2017 17:08

Cool that's good to know. I do use that method in game maker but I wasn't sure if it was possible in Amos.

I'm actually using the plotted points method at the moment and it seems to be working well. Very well in fact, but if it goes tits up at least I have the other method.

Retro1234 23 September 2017 17:11

Cant you use normal Bob, Bob collision if there attacking you know its a hit, if there just walking its not a hit, if your blocking its not a hit etc


All times are GMT +2. The time now is 11:01.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.

Page generated in 0.03981 seconds with 11 queries