Thursday, 15 August 2013

Reset Drag and Drop Game - ActionScript 3 - Flash

Reset Drag and Drop Game - ActionScript 3 - Flash

I am working on a Drag and Drop game in ActionScript 3.
When I click for a new game, the objects stay matched, not in their
original position.
How to reset its positions when a new game starts?
var dragArray:Array = [square_word, circle_word, triangle_word];
var matchArray:Array = [squareMatch, circleMatch, triangleMatch];
var posArray:Array = [ {x:276, y:207}, {x:443, y:207}, {x:107, y:207} ];
var dragGame:DragGame = new DragGame(stage, dragArray, matchArray, posArray);
dragGame.addEventListener(DragGame.MATCH_MADE, onMatch);
dragGame.addEventListener(DragGame.NO_MATCH, onFlub);
dragGame.addEventListener(DragGame.ALL_DONE, onDone);
function onMatch(event:Event):void {
var matchSound:Sound = new MatchSound();
matchSound.play();
}
function onFlub(event:Event):void {
var flubSound:Sound = new FlubSound();
flubSound.play();
}
function onDone(event:Event):void {
var applause:Sound = new Applause();
applause.play();
}

No comments:

Post a Comment