I’m making a game where after you solve a puzzle to unlock a drawer on one frame, it’s supposed to permanently start taking you to a different frame that displays that drawer open. The code I have runs without error but isn’t working as expected, so some help would be nice
The puzzle consists of three boxes, each as their own clip with 3 symbols that can be cycled through. behind those boxes are colored squares whose colors can be set by clicking and dragging a color over to them. The goal is to match a particular combination of symbols and colors.
The code I made for checking the solution is as follows:
if (sq1.timeline.frames === 3 && sq2.timeline.frames === 1 && sq3.timeline.frames === 2 && project.rightBox == 3 && project.middleBox == 2 && project.leftBox == 1){
project.puzzleLock = 1;
}
sq1-sq3 refer to the clips containing the boxes with symbols to cycle through and is trying to check the frame number. project.leftBox and its ilk are trying to verify the value of global variables assigned to each of the colored squares in the following example code on the draggable colors:
for(var a of pink.clones){
if(this.hits(left)) {
left.activeFrame._children[0].fillColor = ‘#D940DD’;
project.leftBox = 3;
this.remove();
}
}
The following code is on a button in another frame/area, and meant to check whether the puzzle has been solved or not and take you to the correct frame/area.
if (project.puzzleLock==1){
gotoAndStop(29);
}
else{
gotoAndStop(28);
}
I am not sure where I am going wrong, and I must admit I have zero JS experience and have been working off of tutorials and a couple years of C from five years ago so I’m apologize if the problem is an obvious one