Hello all!
I’m trying to build a game that’s a dunking booth. With two balls that yoyo until each is clicked, at which point they should stop and then using the positions of the two balls the actual ball is thrown at the target.
I’m so far away from that it’s obscene.
Here’s my code:
package {
import fl.transitions.Tween;
import fl.transitions.TweenEvent;
import fl.transitions.easing.*;
import flash.display.MovieClip;
import flash.text.TextField;
import flash.events.Event;
import flash.events.MouseEvent;
public class dunking_booth extends MovieClip {
private var score:int;
public function dunking_booth() {
var horTween:Tween = new Tween(horball,"x",Regular.easeInOut,203,325,2,true);
var verTween:Tween = new Tween(verball,"y",Regular.easeInOut,43,229,2,true);
horTween.addEventListener(TweenEvent.MOTION_FINISH,horback);
verTween.addEventListener(TweenEvent.MOTION_FINISH,verback);
verball.addEventListener(MouseEvent.CLICK,verclicked);
horball.addEventListener(MouseEvent.CLICK,horclicked);
score = 0;
}
public function horback(event:TweenEvent):void {
//trace("Hor rewind fired");
//trace(event.currentTarget);
var horRew:Tween = (event.currentTarget as Tween);
horRew.yoyo();
}
public function verback(event:TweenEvent):void {
//trace("Ver rewind fired");
//trace(event.currentTarget);
var verRew:Tween = (event.currentTarget as Tween);
verRew.yoyo();
}
public function verclicked(evt:MouseEvent):void {
trace("Mouse Clicked on Vertical");
trace (evt.target.name);
// Here is where I planned on stopping the tween that is moving the ball movieclip
}
public function horclicked(evt:MouseEvent) {
trace("Mouse Clicked on Horizontal");
// Here as well.
}
}
}
I imagine I’m doing a bunch of things redundantly, if anybody can point me in the right direction I’d deeply appreciate it.
Thanks.