I want to ask if someone can give me some hints with a design decision I want to make.
My project will feature some sprites (expecting 10 to 30 on the screen at once), and there are several ways to implement them. One way would be CSS-Sprites, another is drawing them on a canvas. Both are not difficult. The background will be a tile-map drawn by another <canvas>
, in the background.
I've seen that Crafty attaches Sprites as <div>
that is in the HTML within the <canvas>
, as a CSS-Sprite. I am not sure if there's a speed difference if the <div>
is in the canvas or not. Is there a difference?
I expect the user to interact with the sprites, by mouse clicks, left, right, etc. And the sprites are of course standing or walking on elements of the tile map. So is it more efficient to write a handler for the <canvas>
and find the sprite, or rather using the <div>
and let the browser handle the finding?
I hope I could communicate my problem.