myrtlerat's Recent Forum Activity

  • Thanks! I finally got my code working properly. Those examples of other flood fill implementations were really helpful.

    It's really great to have such knowledgeable and helpful people on the forums.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm busy working on a game that has a tiled map. As the player explores the map, it reveals one tile at a time based off line of sight. If a player enters a clearing, the tiled map will populate itself from an array using a flood fill algorithm. I am working on implementing a similar algorithm the one posted below (found on Wikipedia)

    Flood-fill (node, target-color, replacement-color):

    1. Set Q to the empty queue.

    2. Add node to the end of Q.

    4. While Q is not empty:

    5.     Set n equal to the last element of Q.

    7.     Remove last element from Q.

    8.     If the color of n is equal to target-color:

    9.        Set the color of n to replacement-color.

    10.        Add west node to end of Q.

    11.        Add east node to end of Q.

    12.        Add north node to end of Q.

    13.        Add south node to end of Q.

    14. Return.

    I am having difficulty getting the while loop to work properly in Construct 2. Either the while loop runs, but never populates new objects into the layout, or it freezes entirely (for unknown reasons). I've had a really hard time finding the problem in my logic. I'm far more used to traditional coding so this is a new experience for me.

    If someone could take a look at the .capx file I've linked to and show me where my problem is I would appreciate it.

    dropbox.com/s/mltckrw8wnjpks5/Sample%20Project.capx

myrtlerat's avatar

myrtlerat

Member since 5 Sep, 2012

None one is following myrtlerat yet!

Trophy Case

  • 12-Year Club
  • Email Verified

Progress

13/44
How to earn trophies