Okay, so there are three boolean values. Only one boolean value can be true at a time. If one of the boolean values is already true, it should stay true if the condition hits it, it should not revert back to false. Note that activeCrate1 should be true by default.
When the condition hits activeCrate2, it is true and all other boolean cases are false.
When the condition hits activeCrate3, it is true and all other boolean cases are false.
But how do I hit activeCrate1, and return it again to true, and all other boolean values should be false?
And for example, if the condition hits activeCrate1 which is already True, it should stay true and nothing should change. How can I make it work that way?
Two questions in total, but need to be implemented in the same code.
The code goes like this:
activeCrate1: true,
activeCrate2: false,
activeCrate3: false
if (state.activeCrate2 === false ) {
state.activeCrate2 = true
state.activeCrate1 = false;
state.activeCrate3 = false;
} else if (state.activeCrate3 == false){
state.activeCrate3 = true;
state.activeCrate1 = false;
state.activeCrate2 = false;
Aucun commentaire:
Enregistrer un commentaire