[HOW TO] random tiled background

Get help using Construct 2

Post » Sat Jul 21, 2012 1:02 am

Hello

I'm planning in making a 'huge world' for a game and it will be grid based. So I was thinking about adding a random tiled background to make the game look better(example: grass with many different sprites).
But to be honest I have no idea how to do that..
Right now I'm adding tile per tile in the game 'map' and with events they will set a random image but with this method the game will have ALOT of objects in the screen..
the advantage of tiled background is only 1 object that you can adjust the size.. it's possible to do that too but with random set of images in each 'tile'? keeping only 1 object?
B
30
S
6
G
5
Posts: 433
Reputation: 6,061

Post » Sat Jul 21, 2012 1:16 am

That sounds like a nice feature.

If I've understood correctly, you want to be able to add different images to a TiledBackground object (like frames in sprite objects) and have the TiledBackground pick a random frame for each tile. I think that could be useful, but it would have to be added. The object could have a property where you could choose if the order should be random or not.

The best way I can think of is adding several instances of a Sprite object with different frames, and pick a random frame through events. But I know that's not what you're looking for.

Maybe you should make a suggestion in the "C2 General" subforum. If you don't, I think I will.
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Sat Jul 21, 2012 10:03 pm

[QUOTE=Nimtrix] That sounds like a nice feature.

If I've understood correctly, you want to be able to add different images to a TiledBackground object (like frames in sprite objects) and have the TiledBackground pick a random frame for each tile. I think that could be useful, but it would have to be added. The object could have a property where you could choose if the order should be random or not.

The best way I can think of is adding several instances of a Sprite object with different frames, and pick a random frame through events. But I know that's not what you're looking for.

Maybe you should make a suggestion in the "C2 General" subforum. If you don't, I think I will. [/QUOTE]
Yes, you understood correctly ;)

Maybe Scirra can create this new feature, would be awesome..
Can be called something like 'Random tiled background' ;D
I will suggest that and hope I get some support from u guys ;)
B
30
S
6
G
5
Posts: 433
Reputation: 6,061

Post » Sun Jul 22, 2012 2:31 am

B
79
S
24
G
54
Posts: 4,741
Reputation: 40,745

Post » Sun Jul 22, 2012 2:58 am

[QUOTE=R0J0hound] Here is a way to do it:
http://dl.dropbox.com/u/5426011/examples13/randomTiledBackground.capx made with r99[/QUOTE] Hey RoJ0hound, thanks for your help ;)
but this isn't exacly what I meant, the real purpose is to make it random but maintaining only 1 object.

In your example, there is 69 sprites created. The ideal would be an object in C2 that acts like tiled background but with random sprites like in your example, the final result would be 1 object.

But once again, thanks for your time and surely this can be used ATM ;)
B
30
S
6
G
5
Posts: 433
Reputation: 6,061

Post » Sun Jul 22, 2012 3:09 am

This is a great solution in my opinion. If you're worried about performance, it wouldn't be faster if you only had one object. There's no logic applied here, and as far as I know the time to draw the sprites would be the same. Unless there's some other reason I missed?
B
27
S
8
G
8
Posts: 903
Reputation: 8,452


Return to How do I....?

Who is online

Users browsing this forum: anty21ro, dieblume86, Kagubro and 2 guests