Not exactlyā¦ this will be a long explanation:
Here is a super-duper special version of the project for you:
slot_machine_example_v2b.zip (56.6 KB)
It stills donāt evaluates sub-matches (on purpose) but it has a small and useful change: it copies the results stored in the āvalueā object variable of each slot object to a more accesible variable in the result data structure.
What it means?
Well, it means you can access the result of each slot with this expression:
For the result of the first slot: Variable(result.slot_1)
For the result of the second slot: Variable(result.slot_2)
For the result of the third slot: Variable(result.slot_3)
Etc
So you just need to check if two slots have the same result to see if they match, using a condition.
In this example you are evaluating if the result of the first and second slots are matching (consecutive):
Condition | Variable result.slot_1 is = To Variable(result.slot_2)
Action | [Whatever you want...]
And in this another example you are evaluating if the result of the first and third slots are matching (non consecutive):
Condition | Variable result.slot_1 is = To Variable(result.slot_3)
Action | [Whatever you want...]
But be careful! Remember: you donāt need to evaluate any sub-matches if you have a full match. So, first check that condition.
On the other hand, if you are NOT planning to use more than 3 slots AND, as you are saying, you want to check for matches in consecutive slots and the slots at the sides of the row THEN you donāt even need to do those evaluations.
Why? Because if there are only 3 slots and you are evaluating sub-matches of 2 different slots then:
- There are only three possible positions where a matching pair can be and all of them are valid:
- The matching icons are on the sides
- The matching icons are next to each other and are in the slots 1 and 2
- The matching icons are next to each other and are in the slots 2 and 3
So itās irrelevant where they are.
- There can be only one sub-match (if you have two, it is a full match).
So you donāt need to check for other sub-matches.
So, againā¦ IF YOU WILL ONLY USE 3 SLOTS AND THE SUB-MATCHES YOU ARE CHECKING ARE THE CONSECUTIVES SLOTS AND THE SLOTS AT THE SIDES OF THE ROWā¦ THEN AND ONLY THEN all the answers youāre looking-for are already being calculated by the algorithmā¦ everything is in the variables.
Want to know if there is a sub-match of two slots? Check the variables that holds the number of instances of an icon in the result row, you knowā¦
For the number of instances of the first icon: Variable(result.icon_1)
For the number of instances of the second icon: Variable(result.icon_2)
For the number of instances of the third icon: Variable(result.icon_3)
For the number of instances of the fourth icon: Variable(result.icon_4)
etc
If the value of one of those variables is equal to 2, you have a sub-match (the only one that can exist if you are using only 3 slots).
So I guess you can guess what to do with this.
[b]ADVICE:
READ EVERYTHING IāM SAYING IN THIS POST AGAINā¦
READ THE INSTRUCTIONS IN THE COMMENTS OF MY PROJECTā¦
READ THE GDEVELOP WIKI, THE DEATH SEA SCROLLS, THE POPOL VUH AND THE BRITISH ENCYCLOPEDIAā¦
AND WHEN YOU FINISH READING IT ALLā¦ READ IT AGAIN![/b]
Good luck!
ā¦ and let me know
[size=85]if you need [/size]
[size=50]more helpā¦[/size]