[HOW TO] random tiled background

0 favourites
  • 6 posts
From the Asset Store
Each tile 64 by 64 pixels - Ultimate Tile Set for your awesome games
  • 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?

  • 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. <img src="smileys/smiley20.gif" border="0" align="middle" />

  • 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. <img src="smileys/smiley20.gif" border="0" align="middle" />

    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 ;)

  • Here is a way to do it:

    http://dl.dropbox.com/u/5426011/examples13/randomTiledBackground.capx made with r99

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here is a way to do it:

    http://dl.dropbox.com/u/5426011/examples13/randomTiledBackground.capx made with r99Hey 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 ;)

  • 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?

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