Where you are using 'c' you are using the variable that the hype js uses.
And then you are changing it. This is not a good idea.
To show you why if you export your project to folder.
You will find scene 2 will never load because you have changed this foundation variable and other things may break because of this.
This is why we are saying do not use it.
The problem you are trying to solve is having an index number stored in a variable that is not influenced by each drag call to the function.
i.e if you used:
var indexCounter = 0; at the top of your function , indexCounter would always be 0.
There are various ways to solve this like using the head, but I have included in this example one of them that keeps everything in one function.
I have renamed your 'c' var to a global var named window.counterIndex and initiate it within a if not exists clause. Which allows us to only set it once.
I have also used a similar method and a timeout interval to fix the issue you have with the scene 2 bat/dragger/becco
You probably found that when the scene changed you were unintentionally hitting objects on scene 2 because you where still dragging during the transition.
So in your code you started using class names for the dragger and of course you need to get the correct index of the dragger for each scene.
The new bit of code changes the required dragger class's index number but does that within a timeout, which allows the dragging to stop while the scene changes.
(You could also just give each dragger a unique id and use a similar method. Doing away with the class on the end)
None of this is probably perfect but does give you some idea of how to solve your issues.
hittestXX v2.hypetemplate.zip (21.6 KB)