How are collision events done in c++? Eg if sword hits enemy enemy dies. If player hits spikes he bounces back and takes damage.I think it has something to do with the two x,y cords being the same when specific events happen. Are there any examples anywhere.
Collision Events
Page 1 of 12 Replies - 337 Views - Last Post: 23 January 2012 - 04:10 PM
Topic Sponsor:
Replies To: Collision Events
#2
Re: Collision Events
Posted 23 January 2012 - 03:19 PM
Well a way that you could handle it is you have two collidable objects to start with (of course). I know one way it's done is when something attacks, a collidable rod is created at the attackers center pointing in the direction of the attack. Then, if that rod is colliding with anything other than the attacker, deal damage if that is an enemy and kill if the health is low
In order to do something like this, you should have a good physics engine and it needs to give lots of information about what happened like what two objects were involved in the collision etc.
In order to do something like this, you should have a good physics engine and it needs to give lots of information about what happened like what two objects were involved in the collision etc.
#3
Re: Collision Events
Posted 23 January 2012 - 04:10 PM
First you need to establish what a collision is, and common methods are bounding box/sphere collisions - this will tell you if you hit an object. To these bounding shapes you apply attributes to determine what they are.
When a collision occurs between shapes with certain attributes you trigger a new action and/or state.
When a collision occurs between shapes with certain attributes you trigger a new action and/or state.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote






|