Gesture Sequences in javascript

Im new-ish to javascript and not all that clued up on unity game development for the moment, but hoping to learn from this.

The script Im trying to make is a script to cast spells by moving the mouse to create a gesture, eg, a square=fireball.

At the moment I have 9 cube game objects, all tagged individually, to allow for a square, Z and L shape gesture. I’ve tried attaching a script to each cube that triggers a boolean onMouseEnter. Then I created a seperate script to call the results of the boolean from each game object (using tags)to trigger an if statement that basically says if a+b+c+e+g+h+i == true){castspell;} (This being the Z shape). This didn’t seem to work for me. Is this the right way to go about it? If not, what is?

I realise there is a similar question out there, but this requires them to be activated in a specific order, and to reset if the sequence is incorrect.

Thanks in advance.

Would it be possible to create an array, then add a value to the array onMouseEnter for each cube?


//On each cube

function onMouseEnter ()


//On separate object
var myArray = new Array();

function Update ()
if (myArray == “A”&&“B”&&“C”&&“E”&&“G”&&“H”&&“I”)
print (This Works!);
I’d appreciate it if someone could shine some light on this for me :slight_smile: