Results 1 to 2 of 2
- 10-03-2012, 08:24 PM #1Farscience
- Join Date
- Sep 2012
- Rep Power
Efficient/fast collision detection system help.
I know how to do the simple kind of collision detection (making rectangles around my sprites and checking to see if they intersect), but now I'm working on a scrolling game (the kind with tiles). To have any kind of details, I need to generate a couple to generate a couple thousand tiles, but when I loop it, it tests every single tile to see if it collided with my camera entity, to check if it should be drawn. Checking a couple thousand tiles against a couple thousand tiles give me 0.001(my estimate) FPS.
The problem: Could anybody show me a small example of a more efficient way to check collisions, or maybe an idea to change my strategies?
Note: I googled it but every page I checked on collision detection told me to do it my way.
P.S. I didn't post any code, but if you need it, I can.
- 10-03-2012, 08:48 PM #2
Re: Efficient/fast collision detection system help.
If you have a 2D tile system, I'm going to assume you have something like a 2D array. From there it should be pretty trivial to figure out which indices of the 2D array are on the screen. No real "detection" necessary.
- By mwr1976 in forum Java 2DReplies: 2Last Post: 04-14-2012, 12:45 PM
- By Äppelpaj in forum Java 2DReplies: 1Last Post: 10-13-2011, 03:29 PM
- By sunde887 in forum Java 2DReplies: 2Last Post: 10-07-2011, 11:40 PM
- By Harwad in forum New To JavaReplies: 1Last Post: 01-23-2011, 01:38 AM
- By dotabyss in forum Java GamingReplies: 0Last Post: 03-14-2010, 07:13 PM