Hi,
I’m making a jigsaw for an assignment and I have to use functions (as that’s the whole point of the assignment). I can get the code to work easily for one piece, but I’m getting the syntax wrong when I try changing the hitTest objects from “piece01” and “piece01drop” (the invisible “space” where the piece should be placed) to this and this+drop. Obviously I’d want to do it like this as I have 35 pieces (piece02, piece 02drop, piece15, piece15drop and so on). I know how to use the correct syntax with a dropTarget, but the same code isn’t working with hitTest.
This is the (basic) coding I’m using :-
dropTest = function () {
if (this.hitTest(piece01drop)) {
this._x = piece01drop._y;
this._y = piece01drop._y;
}
};
Where “this” would be the piece (piece01) you move around, and piece01drop is the space where it goes. I just need to know how to do the syntax to make this function work for all the pieces, and not just the first one.
Thank you!