21 September 2017, 21:12 | #1 |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
|
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! |
22 September 2017, 13:47 | #2 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
|
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. |
22 September 2017, 13:54 | #3 |
Knight Of The Kingdom
Join Date: Feb 2016
Location: It's a bald world!
Posts: 179
|
|
22 September 2017, 22:14 | #4 |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
|
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? |
23 September 2017, 00:40 | #5 |
Registered User
Join Date: Oct 2014
Location: Europe
Posts: 470
|
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. |
23 September 2017, 03:27 | #6 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
|
|
23 September 2017, 16:08 | #7 |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
|
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. |
23 September 2017, 16:11 | #8 |
Phone Homer
Join Date: Jun 2006
Location: 5150
Posts: 5,773
|
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
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Collision Detection | sandruzzo | Coders. General | 5 | 10 June 2016 12:50 |
Sprite collision help | Shatterhand | Coders. Blitz Basic | 8 | 12 December 2015 23:02 |
Slamtilt and RTC collision | Predseda | support.Games | 5 | 22 August 2009 22:28 |
Advice on disassembling non-relocatable code | pmc | Coders. General | 15 | 15 May 2009 14:35 |
|
|