Culi4's Recent Forum Activity

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You could use a Tilemap for this:

    For example:

    Set the Empty tiles to (Tile = 0)

    Set the obstacles to (Tile = 1)

    -On Tile Clicked extract the X&Y into a Local variable

    -Loop in the 4 directions by using the System "For" loop:

    > Dir Right ---> For "X" From (TileX +1) To ((Tilemap.Width/TileSize) -1)
    ---------> Tile at(LoopIndex("X"), Y) is not equal 1 ------> Set tile to your desire frame
    ---------> Else: Stop the loop
    
    Dir Left ---> For "X" From (TileX -1) To (0)
    ---------> Tile at(LoopIndex("X"), Y) is not equal 1 ------> Set tile to your desire frame
    ---------> Else: Stop the loop
    
    Dir Up---> For "Y" From (TileY -1) To (0)
    ---------> Tile at(X, LoopIndex("Y")) is not equal 1 ------> Set tile to your desire frame
    ---------> Else: Stop the loop
    
    Dir Down---> For "Y" From (TileY +1) To ((Tilemap.Height/TileSize) -1)
    ---------> Tile at(X, LoopIndex("Y")) is not equal 1 ------> Set tile to your desire frame
    ---------> Else: Stop the loop
    

    Probably a second condition is needed there to make you stop at the edges so you dont check outside the tilemap.

    Tile is not equal to -1

    Tile is not equal to 1

    If you really need to use sprites then you can still do all the tile checks in the tile map as I showed above and then when you need to change the frames just pick the Sprite tile that is located on that Tile by using Pick by overlapping Point XY

    or

    alternative you can do the same job by using just sprites alone if you add two variables to the sprites:

    Tx

    Ty

    At the start of the layout do a loop to set all the (Tx & Ty) variables and use the same system as the tilemaps. But this time pick tiles by comparations:

    > Tile.Tx = X
    Tile.Ty = Y
    

    Thanks for the reply, I will try to do so.

  • Hello everyone, help me implement the following mechanics: I have a 6 by 6 field, there are obstacles on it. I need that when clicking on an empty cell, the sprite frame of this cell changes and from it, in 4 directions, the frames of the remaining cells change, but stop if there is an obstacle ahead. I guess it's hard to explain, the screenshot should help with this.

    Tagged:

Culi4's avatar

Culi4

Member since 18 Apr, 2023

None one is following Culi4 yet!

Trophy Case

  • 1-Year Club
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

4/44
How to earn trophies