Combat Collision Detection
Author |
Message |
Andrew_R
|
Posted: Tue Mar 03, 2009 9:44 am Post subject: Combat Collision Detection |
|
|
Alright, I know there are already a multitude of Turing Collision tutorials out there, but I can't seem to tackle this problem. I'm currently working on a Turing Stickman fighter game, pretty simplistic, and I have a module that can detect when the two players have collided, using really simple rectangle collision. What I want (and cannot figure out) is to be able to detect from what direction the players are colliding into each other, so that they can no longer move in that direction, and then obviously the next step afterward for me would be to program in the fighting moves. If there is already a thread that can point me in the right direction here, please share, otherwise, I'm looking forward to any help, I appreciate it! |
|
|
|
|
|
Sponsor Sponsor
|
|
|
DemonWasp
|
Posted: Tue Mar 03, 2009 9:50 am Post subject: RE:Combat Collision Detection |
|
|
The Tutorials Section happens to have a rather neat thread about this very subject. |
|
|
|
|
|
Tallguy
|
Posted: Tue Mar 03, 2009 10:57 am Post subject: RE:Combat Collision Detection |
|
|
just a suggestion, dunno if this helps, but if your stick ppl are different colors use 'whatdotcolor' in an if statement. so if the two colors meet then, move the opposite direction.
hope this helps, this is a VERY simple collision detector |
|
|
|
|
|
The_Bean
|
Posted: Tue Mar 03, 2009 3:03 pm Post subject: Re: Combat Collision Detection |
|
|
Don't use View.WhatDotColour(), its really slow and not the great if arms and legs on the stick people are moving.
A simple way to do it would be to know which direction they are currently traveling:
If they are traveling to the right (their x movement is positive) and theres a collision, then they can only move left (their x direction is negative).
Same thing for the other character.
Option 2 is to see which character has the bigger x value.
The character with he bigger x value will be on the right of the other character, and only be able to move left.
Same thing for the other character, but he will only be able to move left because his x value will be smaller. |
|
|
|
|
|
Andrew_R
|
Posted: Wed Mar 04, 2009 9:21 am Post subject: RE:Combat Collision Detection |
|
|
DemonWasp, I'll defiantly give the turing tutorial section another look. Tallguy, the stick people in my game have moving arms and legs, so I'm guessing it would be pretty difficult to implement your idea, but The_Bean, I'm really liking your second suggestion about the X Y coordinate comparisons, and I'm going to give that a try before I go on to anything else, thanks a lot, I'll post back when I try it out and we'll see how it goes. |
|
|
|
|
|
|
|