Gravity

BlitzPlus Forums/BlitzPlus Programming/Gravity

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

@Corae,,, Nothing against the way QuietBloke suggested, only trouble is that in some cases it's possible to go through a wall. As for the speed overhead, I'd say this is insignificant, and I can hardly imagine a game that needs to have over 2000 sprites falling onto a platform (there is no way to display them all without them covering each other) also the FPS decrease is more due to drawing each Sprite than because of the collision system. I have also found out in my tests that there is a very slight performance hit of around with 2000 sprites falling at a speed of 1000 pixels per frame (still performs well over 60 FPS with 2000 sprites) and it still detects a one pixel platform.

Also with the method QuietBloke suggested, once the sprite hits the platform, the speed hit will be very similar.

So unless you need to have 20000 sprites falling at a rate of hundreds of pixels. And remember that in this case drawimage will dramaticaly slow down performance(maybe you'd need to write an ASM routine that's more optimized than Blitz' one). This method works very well.

Note: locking the buffer and using readpixelfast will of course increment performance.