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)
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)
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.
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]
… and let me know
[size=85]if you need [/size]