[SOLVED] How to pass adjacent object value to neighbor object

I am not sure if this is what i did ask for
Maybe i just explained it poorly
I didn’t have even time to test it
Right now its 2 am and i finally have a moment to check this out
But as i read trough your events i am not sure it will do what i want it to do

You see my game works fine nothing needs to be fixed
Only thing i wish to improve is how AI is picking what piece to click
Right now i am going for random piece with highest dot count

Where what i want to do is for AI to always go for 3 dots piece when it is AI turn and next to it is 3 dots piece of player
Meaning AI piece will expand (pieces with 3 dots when clicked gets 4th dot and expand into 4 pieces with 1 dots going up down left and right)
Claiming player piece in the proces
That is only thing i need
BUT only part i miss is how to make game check where is red (player) piece with 3 dots next to blue (AI) piece with 3 dots
So AI can pick that piece
For that i would need a way to send for example variable to piece on the left from red piece one grid space ahead and i could call it lets say DotsLeft
Repeat it with DotsRight up and down so i have 4 vars
Now i could check IF any of that var is equal to 3
And if so it would mean for AI that there is 3 dots piece next to it
I could make collision check but that would allow diagonal check
Where diagonal neighbors would have no value for difficulty of AI
If i disable checking collision by touching with edges then i would be back to square one since none of the collision would work or i would need to edit collision mask which i try to avoid

While i was writhing above i was testing some crap
I was testing raycast
I could not get it to work properly
I never used raycast and i am bad with arrays
That’s why i wanted to get raycast to work 1st
And i found this raycast example GDevelop 5
By modifying events a little and adding instance copy of player on scene (basically i just added for each event for player and disabled inverted raycast event)

I was able to get it to work in my game
With

And get this

As you see i am able now to get animation and variable of each piece and do various stuff depending on that values
For example 3 dots tint to red where 2 dots tint to blue
Pieces are managed by Dots variable and animation index is changed to value of Dots variable
Now its time to make some evil AI

@Keith_1357 WTF!?


THIS?
When i only needed this for one direction

WTF!?
Damn i haven’t that good laugh for a long
You made my day and taught me again to not be afraid to try stuff out and learn

@Keith_1357 @MrMen I really do not care what you will think but i love you 2
I help ppl on discord i help ppl here but when it comes to save my ass i always see one of you as author of reply
I hope one day i will be able to solve your problems if you have any

2 Likes