TiledBackground multiple frames (like sprite)

0 favourites
  • 10 posts
From the Asset Store
Selection frame like in RTS games, works both on mobile and desktop devices.
  • So I want to make a plugin that lets you add and switch between frames of a TiledBackground just like a Sprite.

    I was hoping this would just be a matter of copy-pasting & tweaking some stuff from Sprite->TiledBackground, but I can't actually seem to find anything in Sprite that tells it to bring up the animation editor and store multiple textures.

    It looks like both Sprite and TiledBackground call the same function, yet with different results:

    this.instance.EditTexture();

    Is there some behind the scenes trickery going on?

    My goal is to let players customize the wallpapers on the walls of their in-game shop, which is a TiledBackground. Creating ~20 TiledBackground objects and then using some huge if-chain to spawn/destroy whichever one they select sounds really clumsy. So I thought a more elegant solution would be to add multiple frames to a TiledBackground.

    Thoughts?

  • In the edittime.js you have to add some flags to let the plugin know it needs to "hook" on those functions.

    Check the plugin settings, flags are explained.

    Hopefuly it should resolve your issue.

  • Thanks dude! Can't believe I missed that.

    BUT it still doesn't work. I tried adding the flags 1 by 1, starting with pf_animated and the animation editor opens but as soon as I add pf_texture (which I need to do the tiling like in tiledbg) the animation editor stops opening. It appears to be you can only have 1 or the other flag active, but not both at the same time. Dang! <img src="smileys/smiley5.gif" border="0" align="middle" />

  • EditTexture() opens either the image or animations editor depending on whether pf_texture or pf_animations is set.

    pf_texture and pf_animations are mutually exclusive, you can't have both! Your object either has a single texture or a complete animations system, not both.

    Your best bet is probably to copy+paste Sprite and change its draw code to match Tiled Background's.

  • It wooooooooorks! <img src="smileys/smiley31.gif" border="0" align="middle" />

    well, at least the basic tiling + animation, now I just need to polish it up a little

  • This sounds interesting, in my current project im using mass amounts of tiled backgrounds (and still a little worried about performance to be honest).

    Will using your plugin be much more efficient (cpu wise) than using sprites if you were to add animations? I hope that makes sense.

    If so - very cool.

  • I'm really not sure about the performance, and I won't be able to release this as a plugin, sorry. I'm only doing this to solve 1 highly specific problem in my game, and it would take really really really to bring it up to a releasable quality level. There's just so much to consider like caching, animation frame sizes, rendering modes, rotation, effects, etcetcetc. As it stands it works for what I want to achieve, but everything else is broken.

  • Ah i see, fair enough. Best of luck with it all.

  • GenkiGenga tiling via Sprite would be slightly less efficient than tiling with Tiled Background objects, since Sprite has a small overhead for having the animations system.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the input Ashley, been digging around and I think I have a much better understanding of how it all works now (image-wise). I was hoping this plugin might let me do things like animate a waterfall for instance, while still technically being a tiled background for optimisation. No matter though.

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