Hi
I have used the following tutorial to create a drap and drop game…
http://www.monkeyflash.com/flash/drag-and-drop-2/
Source file can be downloaded here:
http://www.monkeyflash.com/files/dragdrop2.zip
I need the objects to snap into the center of the targets upon release, how do I do that?
I have tried but my lack flash experience is a problem…
var counter:Number = 0;
var woodSound:Sound = new Sound();
woodSound.attachSound("woodblock");
onEnterFrame = function():Void{
if(counter == 4){
reply_txt.text = "Congrats, you're finished!";
}
};
square_mc.onPress = function():Void {
this.startDrag(true);
reply_txt.text = "";
this.swapDepths(this.getNextHighestDepth());
xstart = this._x;
ystart = this._y;
};
square_mc.onRelease = function():Void {
this.stopDrag();
if (eval(this._droptarget) == squareTarget_mc) {
reply_txt.text="You got it!";
this.enabled = false;
counter++;
woodSound.start(0,1);
}
else{
reply_txt.text="No, keep trying!";
this._x = xstart;
this._y = ystart;
}
};
Thank you very much…
-Bonwhis