1

Possible Duplicate:
Basic 2d collision detection

Hope you can help me out with this one. I'm new to c# so am very inexperienced. But basically I'm trying to make a game in which certain objects fall from the sky. Some objects like feathers take a while to drop, while metal balls will drop faster. You start off with a certain amount of cash and can buy weapons of your choice to place on the ground below. Now I've never done anything to do with collisions before, so simple answers will be of much help!

Here are some of the collisions that will be in the game: (Not sure if different types of collisions are coded differently)

  • Collision between bullets and falling objects
  • Collision between falling objects and the ground (which is inanimate)
  • Collisions between falling objects and a certain radius around another object (for example, if a weapon gives off a radiation beam starting from its centre)
  • Collisions between rotating objects (rotating blade) and falling objects

If someone could help me with this, it would be much appreciated!

Community
  • 1
  • 1
sookie
  • 2,437
  • 3
  • 29
  • 48
  • I agree with @Vyktor here, this is a dupe (it's not a crime, it's just general housekeeping on the community's part) - also I hope you're not using *images* for all these things you're talking about - for accurate collision detection you need to using as-mathematical-as-possible representations of the objects you're colliding. E.g. a beam would be a vector, a ball would be a point + radius (or indeed point + vector if orientation is important). – Andras Zoltan Nov 14 '12 at 11:01

1 Answers1

0

I had a similar problem few months ago with sea current calculation. Also there was an algoritham to be solved (10y ago programing competition for elementry school) about cards hitting ground and detecting if there is ovelaping.

With sea current i had nearly infinit number of vectors for stream path, so i calculated minimum radius from which within it current was unaffected by obstacles. If current came too close to obstacle (within min radius) real calculations for exact collison started.

About cards. Card is represented by 4 points. lets say 2d, (0,0), (1,0), (0, 1), (1, 1). to detect if another card overlaps it, just detect if any of second card points is placed within that square and vice versa.

For a real bullet/feather colision check topic that Vyktor mentioned previously.

Gustav Klimt
  • 430
  • 3
  • 14