Tilesheet - pros / cons & Collision

Hi -

I’m curious…
What are the pros/cons of using Tilesheet to render graphics, rather then just rendering bitmaps as sprites on their own? Also, is it possible to use the tiles to check collision(built in solution?) or should i use a 3rd party library for that?

It is a lot faster (especially on mobile/low power machines) and you can handle thousands of tiles at 60fps.
So the advice is USE IT!

To handle the collision you need another part, Tilesheet only handles the drawing, all the logic and positioning and so on it has to be somewhere else. Actually also all the batching process to tell the Tilesheet to be drawn has to be written.
But this is the same as Bitmap as sprites…

You can use a library for the collision and write your own batcher or you can use a complete library like HaxeFlixel or HaxePunk.

If you start writing it on your own it is going to be long :wink:

Fair enough.
cheers :slight_smile:

I’ve been trying to get box2d running but failed miserably so I guess i could cut it short and use HaxeFlixel but that feels a tad overkill when all I want is simple box collision lol.

I would say if it is only box collision I would say try this way

You just have to write 3 things:


1 . Classes for your object (x,y,width,height)


2 . Batcher that draw everything with just a tilesheet.drawTiles() call

this is an example of a batcher

this is an example of a call to draw all together


3 . finally you need the box collision
this is fast and very easy to use, I love it

http://hamaluik.com/posts/simple-aabb-collision-using-the-minkowski-difference/


It’s always wrong to reinvent the wheel, but if what you need is very easy you can try :wink: