Guest User

Untitled

a guest
May 16th, 2018
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package
  2. {
  3.     import org.flixel.*;
  4.    
  5.     public class Circular_Platform extends FlxSprite
  6.     {
  7.         [Embed(source = '../assets/elevator4.png')] private var elevatorPNG:Class;
  8.        
  9.    
  10.         public var newx:Number = 0;
  11.         public var newy:Number = 0;
  12.         public var placex:Number = 200;
  13.         public var placey:Number = 200;
  14.         public var length:Number = 20;
  15.         public var theangle:Number = 0;
  16.         public var angle_stepsize:Number = 0;
  17.        
  18.        
  19.         public function Circular_Platform(X:Number, Y:Number, Width:Number, Height:Number, Speed:int = 40)
  20.         {
  21.             super(X * 16, Y * 16, elevatorPNG);
  22.            
  23.            
  24.  
  25.             //int placex = 200;
  26.             //int placey = 200;// the center point of the circle will be at 200 x and 200 y
  27.  
  28.             //int length = 20; //the circel will be 20 pixels from its center
  29.  
  30.             //float angle = 0;
  31.             //float angle_stepsize = 20; //The circle will turn 20 degrees in a second.
  32.  
  33.  
  34.         }
  35.        
  36.         override public function update():void
  37.         {
  38.             //  Has platform reached the end of its movement?
  39.             this.x = length * Math.cos(theangle);
  40.             this.y = length * Math.sin(theangle);// the angular math thingy
  41.  
  42.             this.x = x + placex;
  43.             this.y = y + placey;//placing the circle in our world.
  44.  
  45.             angle += angle_stepsize * FlxG.elapsed;//multplying the stepsize by the
  46.             //time spent since last frame to make sure it moves only 20 angles
  47.             //per second.
  48.    
  49.            
  50.            
  51.         }
  52.     }
  53. }
Add Comment
Please, Sign In to add comment