playMaker

Author Topic: Finding Tags inside and array  (Read 1085 times)

Fonkles

  • Playmaker Newbie
  • *
  • Posts: 10
Finding Tags inside and array
« on: May 26, 2016, 10:57:00 AM »
Hello Playmakers,

I hope you can help me. I am still working on one of my graduation prototypes but I am stuck.
I have a gameboard existing out separate hexagon game objects, players are represented by the colours.
In each turn a player can take over another hexagon by clicking it with the 'Mouse pick event' action.
Because I want the player only to be able to take over adjacent from hexagons he/she already has I am using an arraylist. At every mouse click event it first checks if the tharget hexagon is inside the array, if it is it then compares the tags to make sure I do not take over other coloured hexagons.
It then send a raycast in 6 different directions and stores the surrounding hexagons from my click target in 6 GO variables. These variables are then added  to each individual array (every player manager has their own array) and finally I set the material in the correct colour and give the target hexagon a special tag.

Long story short, I want to be able to find the Hexagon Game objects inside my array with the tags.

The mechanic I want to create is that if a player sourrounds a free hexagon or a hexagon of another colour with 4, or more, of their own hexagons, the surrounded hexagon automatically converts to the players colour.

In the added image you can see what I mean with surrounding if you look at the yellow, blue and black players.

I am at a loss on how to do this. I found some posts that there was going to be an action specifically for this but I cannot find it. I hope one of you can put me on the right track so I can finish this prototype.

Thanks for reading.

Martijn (Fonkles)

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Finding Tags inside and array
« Reply #1 on: May 27, 2016, 01:37:15 AM »
You could use a get next action to iterate through them get the tag and use a string compare-
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!