A little more progress. I'm able to move movie clips individually and I've also added collision detection:
mc_1.onPress = mc_2.onPress =
function():Void {
this.startDrag(false);
this.onMouseMove = this._parent.checkHit;
};
mc_1.onRelease = mc_2.onRelease =
function():Void {
this.stopDrag();
};
function checkHit():Void {
for(var instanceName in this._parent){
var obj:Object = this._parent[instanceName];
if(obj instanceof MovieClip && obj != this){
if(this.hitTest(obj)){
chuck.text = "collision occuring";
}else{
chuck.text = "no collision yet";
}
}
}
}
Wondering what the difference is between adding event listeners and these "onPress" "onRelease" characteristics.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment