Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package
- {
- import org.flixel.*;
- public class Circular_Platform extends FlxSprite
- {
- [Embed(source = '../assets/elevator4.png')] private var elevatorPNG:Class;
- public var newx:Number = 0;
- public var newy:Number = 0;
- public var placex:Number = 200;
- public var placey:Number = 200;
- public var length:Number = 20;
- public var theangle:Number = 0;
- public var angle_stepsize:Number = 0;
- public function Circular_Platform(X:Number, Y:Number, Width:Number, Height:Number, Speed:int = 40)
- {
- super(X * 16, Y * 16, elevatorPNG);
- //int placex = 200;
- //int placey = 200;// the center point of the circle will be at 200 x and 200 y
- //int length = 20; //the circel will be 20 pixels from its center
- //float angle = 0;
- //float angle_stepsize = 20; //The circle will turn 20 degrees in a second.
- }
- override public function update():void
- {
- // Has platform reached the end of its movement?
- this.x = length * Math.cos(theangle);
- this.y = length * Math.sin(theangle);// the angular math thingy
- this.x = x + placex;
- this.y = y + placey;//placing the circle in our world.
- angle += angle_stepsize * FlxG.elapsed;//multplying the stepsize by the
- //time spent since last frame to make sure it moves only 20 angles
- //per second.
- }
- }
- }
Add Comment
Please, Sign In to add comment