Hello folks and welcome to another episode in this game development project, Today, I'm going to expand on the logic behind the Juke abilities, I used the term abilities because there are two types of Juke(The Juke and the Meta Juke).
As stated from rule number 6 and 7
The Juke is basically an ability that draws the player's chosen number 10 paces closer to the correct random generated guess. If the player number hits the correct guess exactly, it becomes an undisputed jackpot win.
From the diagram above, it illustrates the Juke and the Jackpot conditions.
My First step was to determine if the player's guess is greater than the correct guess, this is to know if I'm supposed to add 10 or subtract 10 from the number.
As shown from the code snippet above, after checking the magnitude of the guess, I then calculated the difference, the difference is cause I want to know if the guess is inside the jackpot zone. If the player's guess is less than 10 then it qualifies for a jackpot win and is added to the jackpot list.
If the difference is not lower than 10, then it pulls the player's guess closer, 10 paces towards the correct guess.
Then I calculate the left part of the equation, in conditions where the player's guess is lower than the correct guess.
I followed the same pattern of logic I used for the previous if conditions, the only difference is that I calculated using the absolute value of the difference because the results produce negative integers which is not my intention.
The meta juke follows the same logic, only that it doesn't have a jackpot zone like the juke and it pushes the player 30 steps closer to the win instead of 10.
Here is a sample of a Juke win below, there is also a log section added to the UI to see how the win is calculated.
The meta-juke is also vulnerable to a jinx and meta-jinx attack. I talked about the jinx and meta-jinx in the previous episode.
This is a sample of a chain attack between a Meta-Juke win and a series of Jinx attacks.
Meanwhile, The Juke is like a normal win, it is important to note that the chain of attack on a normal win only flows in one direction. a meta-jinx attack cannot directly target a normal Juke win but a meta-jinx attack can target a jinx win.
That is all for now, see yall later :-)