SFML community forums
General => General discussions => Topic started by: reethok on May 18, 2013, 07:27:47 pm
-
I just need collision detection :)
Greetings.
-
I just need collision detection :)
What kind of collision detection? If rectangles or circles are enough, just implement it yourself.
-
Different form sprites with transparency. Also, as there will be many of them, i need some efficiency
-
What forms will you have? This determines what collision algorithms to use...
(And how does transparency influence the collision? You probably want to have a separate logical representation of your shapes anyway)
-
Something like this:
(http://memberfiles.freewebs.com/37/52/64535237/photos/Sharing-Sprites/redLaserRay.png)
But will be many different animations (laser and different kind of bullets).
It's for a simple Tower Defense game I want to do. I know how to do everything allready except the collition part.
What i want is t skip the total transparency (it doesnt count of rthe collition), and to set a lvloftransparency that counts. (In that laser sprite, just the brightest will count for the cllition)
Sorry for my crappy english :A
-
Pixel perfect collision is an expensive test and in most cases not unnecessary. You might be way better of with a rotated bounding box test, just google a bit for it.
Tower defense is a widely spread topic, maybe you could give some more insight on how exactly it will be.
-
I wouldn't use a real collision detection for tower defense games. Instead, you could let the bullet fly towards the targeted enemy and then just check the distance between enemy and bullet. Then for approving collision, you can say, that every distance lower than 5.f is a hit or at the latest when the distance starts increasing (the bullet passed the enemy).
That would be a really fast "collision" detection (maybe checking distances, circle collision detection, is the fastest)
Give it a try! :D