Sprite.js surface background

Posted by user1086671 on Game Development See other posts from Game Development or by user1086671
Published on 2012-10-26T15:17:53Z Indexed on 2012/10/26 17:21 UTC
Read the original article Hit count: 120

Filed under:
|

I'm making a tile-based game using Sprite.js. It is not easy to redraw every tile each frame, so I tried to make a scrolling surface background. There is an example here http://batiste.dosimple.ch/sprite.js/tests/test_scrolling.html The example works, but it seems like ScrollingSurface.update is buggy or there is something I'm missing. What I tried to do is to draw 5x5 tiles and after 5 seconds draw another 5x5 tiles near the first ones. But it draws only the first ones. And surface.update() only updates the position of surface. Here is my code https://github.com/Sektoid/sprite.js/blob/master/tests/test_scrolling.html (You need also to set this.divider = 1.0 in scrolling.js to avoid drawing the same tiles 4 times.) There aren't any sprite.js-forums like with the other sprite- and game-engines have, so I'm asking here.

© Game Development or respective owner

Related posts about sprites

Related posts about canvas