Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / defining seprate areas of a model

Author
Message
Jasonorc
16
Years of Service
User Offline
Joined: 29th Apr 2008
Location: Turn around...
Posted: 29th May 2009 21:13
Hi, A very simple question.

How do I make it so when an object collides with different areas of a model it provides different results, here's the reason:

I'm maing a simple zombie game, I want a bullet that hits the head to do 10 damage, to the body 5 damage, and to the legs and arms 2 damage.

How do I define different parts of a model?

My site: www.skyknight.co.uk
bobbel
15
Years of Service
User Offline
Joined: 5th Jan 2009
Location: In my DBPro case xD
Posted: 29th May 2009 21:22 Edited at: 29th May 2009 21:25
this is pretty difficult. as far as i know, you can't define different parts for the model. there is nos uch command as collision object limb or something (again: for as far as i know) what i would do is make the object and place hitboxes around the parts of the model. place a little box around the head and make it invisible, and place it every loop at Object Position Y(zombieobject)+100 or something. you can add another value to your user defined type and fill that with the object number of the hitbox. and for the other body parts of the object, you can just use the whole object. so, in the shoot routine, you first check for collision with the head hitbox. if that is true, you just do the hit head routine. otherwise you check for collision on the body, and if thats true, you do the normal-hit routine. hope you understand that.

EDIT: there is a limb collision command, but if you use intersect object command, it is no use

*ding ding*
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 30th May 2009 00:01
You could check for a collision and once that has occurred, you could check against the limb locations using vector3.

A rough example:


LB

Jasonorc
16
Years of Service
User Offline
Joined: 29th Apr 2008
Location: Turn around...
Posted: 30th May 2009 00:32
So bobbel how would I make that, but on maybe 100 zombies, when I do not make them, I have them randomly generated (At the star of the level it calls a specific amount of zombies, as I don't want to have to make each one enter as a seperate peice of code)

My site: www.skyknight.co.uk
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 30th May 2009 04:01 Edited at: 30th May 2009 04:03
For that you would need to use an array-- one slot for each enemy and have the array hold useful information like object numbers, health, etc. For example, you might create your array like this:

DIM Enemies(100,2)
Where the first slot is the enemy # (1-100) and the first slot of each enemy slot is the object number, while the second is that enemy's health.

Example:

Enemies(1,1) is enemy #1's object number
Enemies(1,2) is enemy #1's health
Enemies(8,1) is enemy #8's object number
Enemies(8,2) is enemy #8's health


You would need to use a FOR/NEXT loop to cycle through all of your enemies. For example, to set everyone's health to 350 you would do this:

for e = 1 to 100
Enemies(e,2)=350
next e

Visit the tutorials section of this board for more info on arrays... I wrote a tutorial on them a while back.

<-- Spell based team dueling game!
bobbel
15
Years of Service
User Offline
Joined: 5th Jan 2009
Location: In my DBPro case xD
Posted: 30th May 2009 09:31 Edited at: 30th May 2009 12:47
yep, i think that's the smartest way... i would use types though, cause that makes it easier if you want to add more enemies, i always had trouble with that.

for more info about this, look at this topic: http://forum.thegamecreators.com/?m=forum_view&t=151449&b=7
i posted at the wrong one

*ding ding*

Login to post a reply

Server time is: 2024-09-28 06:22:34
Your offset time is: 2024-09-28 06:22:34