我正在使用 ActionScript 3 开发拖放游戏。
当我点击一个新游戏时,对象保持匹配,而不是在原来的位置。
新游戏开始时如何重置位置?
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();
}