0 Favourites

Change frame for top most tile

  • So we are using a random tile generator, and we would like to make it so that if a tile is the top most tile, it will display a different animation frame to support it being the top tile, instead of the middle tile. Same with bottom and sides. Is there any good non performance crushing way to do this?

  • In the sprite conditions, you have a specific one for the Z-order : pick top/bottom. This will, giving a current selection of those sprites, filter only the top or bottom instance, for you to change its frame.


  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • This would work if the tiles were overlapping each other, but I'm talking about if the tile is one block higher than the other blocks. Like check out sdiqs game, we are using his random generation. When given a texture, the top most blocks (ones higher on the Y axis) for a given block group will have a different texture


  • To check if a tile is a 'topmost' tile, check if there is a tile directly above it. If not, then change it's frame.

    This could be done using 'Overlapping at Offset':

    is 'Tile' overlapping 'Tile' at offset (0,-1)'

    This will move the 'Tile' up a pixel and test for overlap. Inverting this condition will effectively test whether it's the topmost tile or not.

    For bottom and sides use offsets (0, 1), (-1, 0), (1, 0) respectively.


    If you can figure out (roughly) how your tiling engine works, the best approach would be to tap into its array to figure out if there's a tile above the one you are testing. That would be the easiest and the most straightforward.

  • What if we have collisions disabled for all tiles unless they are within a given range of the player? This is to save performance. Then they won't know if they are overlapping or not right?

    (done at events 1-3 on Event1Sheet)


  • Yeah it won't know. I can't check the .capx from here (restrictions at work), but why don't you try to peer into the array if you can? That would be the best approach.

    If that ends up being difficult to do, you could enable all collisions momentarily before doing the check. After the check you can disable the collisions again. In fact, if your tiles are static, you should do it on Start of Layout. Then you only have to do it once.

  • The problem is C2 can't compare an object against it's own type. You need an invisible clone to position appropriately, and then do any tests. This isn't pretty, but...

    Check Tile Overlap_BHT.capx

  • oh wow! that gets the job done, but it definitely crushes performance.   And since the game is set out to be a mobile game, it might not be the best solution. But you used some very interesting conditions that ive never even heard of! problem is also, that we already have way too many objects for mobile, and this just creates more.

    It's proving troublesome for us to do the random gen, as well as reduce the collisions, as well as change the animation frames of tiles per level (to change the color up) as well as change the type of tile (top tile, bottom tile, side). It seems that there is no good way to do this without ending up with crushing performance.

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