Tiling & spritesheets

0 favourites
  • 4 posts
  • So I have this craptastic frankenstein pile of hacks plugin that combines sprite with the drawing code from tiledbg so that I can make a sprite with animation frames that tiles. It's super buggy (effects, moving, etc cause problems) so I won't publish it, but it worked fine for the its very narrow purpose of letting me easily change the game's background pattern on the fly.

    The game code is supposed to be locked, but I couldn't resist the spritesheet feature so I rebuilt using the latest beta, and of course now it's tiling the entire spritesheet instead of just the animation frame I want.

    Any tips? It would be super if there was just a toggle that says 'don't export as spritesheets for this plugin'. If the only way is to redo the plugin using the update sprite+tiledbg code I think I'll just have to revert my changes and ditch spritesheets since I wasn't really supposed to be touching the code in the first place. <img src="smileys/smiley18.gif" border="0" align="middle" />

    P.s. what would be awesome-est is if sprites and tiledbg were simply combined into 1 so that you would have a 'tiling' setting you can toggle on/off, never really understood the reason for making them separate.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Any thoughts?

    • Can I disable the 'create spritesheets from animation frames on export' behavior for a plugin?


    • How can I tile a spritesheet frame?

    I the weekend trying to figure out a solution without success and after lots of hours am ready to give up now. If I can't solve it within a day or 2 I have to revert to a previous C2 release. <img src="smileys/smiley6.gif" border="0" align="middle" />

  • Sorry for the late reply, I was off this weekend...

    You can fix your plugin but it would be a little complicated. To tile a spritesheet frame you need to:

    1) make a new canvas and get a 2D context

    2) drawImage() the sprite's image on to it (you'll have to see the new code in Sprite's draw() which shows how to draw the part from the spritesheet)

    3) make a new Image() and set its src to canvas.toDataURL() - now you have a standalone image of the section from the spritesheet

    4) now you can make a pattern of that image and draw the section tiled

    I can't immediately think of a way to get this working with WebGL, but you could just turn it off for now.

    It's a good point why sprites can't be tiled and why Tiled Background exists at all. But Tiled Background has a slightly lower overhead than Sprite, and in future it may be possible to better optimise Tiled Background based on the fact it's simpler than sprite.

  • Ok thanks for the reply. I tried your suggestion but that's just beyond my level of knowledge. Gonna stick with C91 for this game.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)