How to fill a layer with sprites

Get help using Construct 2

Post » Tue Dec 24, 2013 3:25 am

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?
B
17
S
3
Posts: 33
Reputation: 1,666

Post » Wed Dec 25, 2013 10:33 am

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 :)
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Wed Dec 25, 2013 12:29 pm

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,
Using R243 for all examples
B
69
S
20
G
6
Posts: 379
Reputation: 9,699

Post » Thu Dec 26, 2013 9:52 am

@phatkidsoftware @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!^_^JJList2013-12-26 10:17:06
B
18
S
5
G
1
Posts: 74
Reputation: 2,672


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 29 guests