English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. AMOS

 
 
Thread Tools
Old 21 September 2017, 21:12   #1
Brick Nash
Prototron
 
Brick Nash's Avatar
 
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!
Brick Nash is offline  
Old 22 September 2017, 13:47   #2
idrougge
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.
idrougge is offline  
Old 22 September 2017, 13:54   #3
OmegaMax
Knight Of The Kingdom
 
OmegaMax's Avatar
 
Join Date: Feb 2016
Location: It's a bald world!
Posts: 179
Quote:
Originally Posted by idrougge View Post
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.
OmegaMax is offline  
Old 22 September 2017, 22:14   #4
Brick Nash
Prototron
 
Brick Nash's Avatar
 
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?
Brick Nash is offline  
Old 23 September 2017, 00:40   #5
Cylon
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.
Cylon is offline  
Old 23 September 2017, 03:27   #6
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
Quote:
Originally Posted by Brick Nash View Post
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.
idrougge is offline  
Old 23 September 2017, 16:08   #7
Brick Nash
Prototron
 
Brick Nash's Avatar
 
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.
Brick Nash is offline  
Old 23 September 2017, 16:11   #8
Retro1234
Phone Homer
 
Retro1234's Avatar
 
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
Retro1234 is offline  
 


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 03:39.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.06944 seconds with 13 queries