Created
June 1, 2009 18:04
-
-
Save akio0911/121631 to your computer and use it in GitHub Desktop.
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
package{ | |
import flash.display.Sprite; | |
import flash.events.Event; | |
public class Wave1 extends Sprite{ | |
private var ball:Ball; | |
private var angle:Number = 0; | |
private var centerY:Number = 200; | |
private var range:Number = 50; | |
private var xspeed:Number = 1; | |
private var yspeed:Number = .05; | |
public function Wave1(){ | |
init(); | |
} | |
private function init():void{ | |
ball = new Ball(); | |
addChild(ball); | |
ball.x = 0; | |
addEventListener(Event.ENTER_FRAME, onEnterFrame); | |
} | |
public function onEnterFrame(event:Event):void{ | |
ball.x += xspeed; | |
ball.y = centerY + Math.sin(angle) * range; | |
angle += yspeed; | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment