Assigning object variables to children of scene array variables

How do I assign object variable values to children of scene array variables (the way it was similarly done in the gdevelop ready made game “tic tac toe”)?

  1. I have 10 objects and each object has an object variable. I also have a Grid array that has 10 children. I’m trying to write an event that matches the 10 children of my Grid array to each of my 10 object variables.

I would like that each time an object animation changes, a number value is assigned to a child of my Grid array. So that for example, when object 1 changes animation the value of child 1 of my Grid array is changed to 100.

I’m doing this so that I can use simple math to determine when certain object animations are changed. So that for example, if player selects four objects and one of them is incorrect, if they have also selected the object called “1 Wrong” (which is object 10 and child 10)that allows them one mistake, and now they are considered as making the correct selection even though they initially made a mistake.

I want to use simple math to check because each childs value is changed to 100. Meaning if I check it with the equation “child 1+child 2+child 3+child 4+ child 10 is greater than 400” they are correct. If they haven’t selected child 10 this equation will only give 400 and the game can easily determine that they are incorrect, because either you have 400 or greater than 400.

Use the change the scene number variable action:

image

Can you explain further. Are these questions or math problems or a puzzle? It’s all a little vague.

Are the objects movable? You said the animation is being changed. How do you decide what the animation should be?

A screenshot of the scene at runtime would help along with any relavent events. Keep the number of pictures to a minimum otherwise people tend to get overwhelmed. You want enough information but not too much.

Player touches objects to change animation, once player clicks “done” game checks to see if selection correct.

I’m trying to replicate the checking system used in a ready made game already on gdevelop (tic tac toe). Here are the tic tac toe pics






I want to be able to add the values of the variables to check if player selection of objects is correct, that way I can make the one free mistake option “1 wrong” an odd number and easily check for that.

For example if each variable value is changed to 100 when object animation is changed, and “1 wrong” variable value is changed to 1 when it’s object animation is changed, the game can check if the 4 variable values added plus the “1 wrong” variable value is equal to 400 or 301(bc “1 Wrong” wasn’t selected it will have a zero variable value).

This didn’t quite work for me. I’m trying to repeat days done in this game:






I wouldn’t bother with an array. I’d put a object down on the screen where ever it is placed on the grid as long as there is no other object already there.

I’d then check if that placement is part of a 3 in a row. Using your tic-tac-toe positions:
[1][2][3]
[4][5][6]
[7][8][9]

I’d go through each 9 positions and check whether the placed object was part of a 3 in a row.

So the first position check would be if:

  • the object placed was the same one spot to the right and 2 spots to the right, or
  • the object placed was the same one spot down and right and 2 spots down and right, or
  • the object placed was the same one spot to the down and 2 spots to the down

The second position check would be if:

  • the objects to the immediate left and right were the same as the dropped object, or
  • the object placed was the same one spot to the down and 2 spots to the down

etc


These directional checks could be held in an array, so one line would hold 2 relative positions for a check. Iterate over the array checking both positions, and if the other 2 objects are the same as the placed one, you have a 3-in-a-row.

To explain my previous post a bit better, the variable set up would be:

Red are the line checks, green are the spots to check and blue are the offsets relative to the current position. The number values are the number of grids cells horizontally or vertically to check. Positive numbers are to the right or down. Negative numbers are to the left or up. A ‘0’ is the same row or column.


The events to play the game would be: