How to fill a layer with sprites

0 favourites
  • 4 posts
From the Asset Store
An educational game for Fill in the Blanks. An easy to use template for developers to build larger games
  • I am working on a "fog of war" type interface and need fill a layer with sprites, to cover the map underneath. I'd like to do this via a loop as opposed to adding the sprites individually. What would be the best way to do this?

  • I tried this on a large map 5x,5x and had a loop generate 100 something by 100 something sprites (black clouds) ....

    when the layout started ... I either had to make the game wait till the sprites were created ... or just go with it that when the game started that it was still building the sprites .... very annoying ..

    Solution:   manually addd the sprites in cs2 where they should go (cover your entire map with the sprites with copy pasting)

    You only need to do it once, but when the game starts ... the fog is there instantly :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I had a similar issue a few months back when working on my RTS. In the end I just made a FOW layer and put them every 64 pixels apart, as the coding and wait time at layout loading was too long,

  • lennaert emoaeden

    Hello! Have you tried using TileMaps for this?

    I guess it might be a decent solution, as it redners insanely fast, campared to using a lot of sprites:)

    You can do something like this:

    Add a TileMap object to a separate layer, right above the layer with a map you want to cover with FOW.

    Create a single black 16x16 tile(or any other size you want, down to 1pix, it will still work relatively fast:))

    Add event on layout start -> set all tiles in TileMap object to 0(that will fill our tilemap with black tiles aka FOW, use "set tile range" action for this)

    So, we have our FOW and we just need to set up it's interaction with the Hero.

    Use something like : Hero moved -> erase FOW tiles at defined range from hero position.

    I hope you get the idea:) This method should work pretty fast and clear.

    I don't have time to make an example capx right now:( Will do it later.

    Untill then, check this topic. It's not exactly what you need, but it gives an idea on how to use tilemaps.

    Also there are examples of how to erase tiles at defined radius and defined position.

    Hope that helps!^_^

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