Created
October 29, 2012 22:24
-
-
Save martisj/3976938 to your computer and use it in GitHub Desktop.
random balloon spawner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function spawnRandomBalloons(te:TimerEvent):void | |
{ | |
var balloons:Array = [new mcBalloonPink(), new mcBalloonGreen(), new mcBalloonRed()]; | |
var rndm:int = Math.floor(Math.random() * 3); | |
trace(balloons[rndm]); | |
trace(balloons); | |
var theBalloon = balloons[rndm]; | |
theBalloon.x = 450; | |
theBalloon.y = Math.floor(Math.random()*(1 + topBoundary - bottomBoundary)) + bottomBoundary; | |
trace(theBalloon.y); | |
//theBalloon.y = Math.floor((Math.random() * 240) - 120); | |
var balloonTween:Tween = new Tween(theBalloon, "x", None.easeNone, 450, -450, 3, true); | |
balloonTween.addEventListener(TweenEvent.MOTION_FINISH, destroyTweenedObj); | |
mcGullGame.addChild(theBalloon); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment