How Can I Make Tiles Change One By One?

0 favourites
  • 4 posts
From the Asset Store
Piano tiles
$9.99 USD
Template for a piano tiles game, fully documented in comments and video
  • Hi everyone i wanted to know how i can make the tiles in this capX file to change one by one instead of all changing at the same time.

    I have them set to check for a collision at an offset and if its true, i want the tile to change from frame 0 to frame 1 but my issue is they are all changing at the same time.I want the tiles to seem like they are Infecting each other when it detects an offset.Is there anyone that can help me with this?My CapX File

  • If you have one sprite that is frame 1 already, you can make it spread in eight directions by putting the sprite in a family then making an event like this:

    every 5.0 second

    family1 animation frame=1

    sprite animation frame=0

    family1 is overlapping sprite

    --- sprite set animation frame to 1

    Of course that is a very general case. For your current setup you could do something simple like this to make the sprites turn red from the right to left with 5 seconds in between.

    Start of layout

    For each sprite ordered by sprite.x descending

    --- wait 5*(1+loopindex) seconds

    --- sprite set animation frame to 1

  • R0J0hound it still isnt working right for me man.

    I want to use this code to make my Grass blocks spread and grow ontop of the next tile to the left or right by checking for collisions at an offset position.I just cant seem to get the blocks to switch one by one once a layout is started.

    If it helps im making a Terraria/Minecraft style Game.

    Thanks R0J0hound

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Instead of using "overlaps at offset" use an array to store the grid for a quick lookup. So if your blocks are 32x32 and have a top/left hotspot, and your layout is 640x480 then your array size will be 640/32 x 480/32 or 20x15. Then fill your array with 0 for empty and 1 for filled if a block is there. Your initial event will look like this:

    Start of layout

    for each block

    --- set array at int(block.x/32), int(block.y/32) to 1

    Then later on for the simple case of instantly growing grass you can see if it's empty above the block like this:

    for each block

    array at int(block.x/32), int(block.y/32)-1 = 0

    --- grow grass

    Anyway regardless, I still think the second part of my last post will work for the situation of the grass growing from the left to right, one per time frame.

    I whipped up an example and I think I found an alternate method that would work better. Basically have the grass grow next to another grass every 0.5 second, but on every 2 seconds make a random sprite grow grass instead. That would solve the issue of needing an initial grass to grow from.

    https://dl.dropboxusercontent.com/u/5426011/examples19/grass%20grow%202.capx

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