How do I check the tiles next to my tile?

0 favourites
  • 9 posts
From the Asset Store
Each tile 64 by 64 pixels - Ultimate Tile Set for your awesome games
  • I want to check how many neighbouring tiles are each tile and then add a value depending, this is the current way I'm doing it but I'm certain there is a better way.

  • You can pick by distance:

    System Pick Blue By Evaluate distance(Placeholder.x, Placeholder.y, Blue.x, Blue.y)<20
    	Set blueVar to Blue.pickedCount
    

    Or add Line Of Sight behavior to the Placeholder, and pick tiles in its sight.

  • For distanced i'd need to put it in a for loop right? So i can check how many are next to it?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • hmm, los seems easier actually.

    How can I make it check the total blues in its sight?

  • Same way - set Blue variable to Blue.pickedCount

    .

    If you have multiple placeholders and want to count their blue neighbors, then yes, you need to do this in For Each loop.

  • alright thanks! ended up going with distance.

    Quick question, how do i do the stuff under 7 after 5 and 6s loops have finished?

  • Not sure I understand your question. Event 7 will start after events 5 and 6 have finished.

    What will happen if for some placeholder Blue=Red? It will not be destroyed and this whole loop #2 will continue executing on every tick. You probably need to reset Blue and Red variables at the start of it.

  • Red will never = blue due to the random weight i have added to it, I think i was doing it wrong so I changed it to this but im still getting the same issues

    I believe atm the way it should be working is the first placeholder should have no neighbours, as such itll get the value of 0.5 under whichever the random is

    Then the next one, being the firsts neighbour, will be the same color, due to the fact they will never not have a different neighbour it should be the same the whole way. Ofc thats not what I want eventually but I'll change the weighted value to 1.5 at some point. Just want to make sure this is working.

    Note the UID order is like this, thats also the order this is using to determine what order the placeholders are changed in.

    Sorry if thats a bit confusing, heres the file if it helps you help me.

    dropbox.com/s/ghz87j3cwwjlzm3/Procedural%20Generation.c3p

  • Looks like the images I shared didn't work... dunno how to fix that sorry

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