Ignore:
Timestamp:
2014-07-03 21:24:16 (5 years ago)
Author:
mijoilmo
Message:

Optimoitu levelin kopioimista. Lisätty basic !space leveli

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2014/27/AleksanteriV/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/Radar.cs

    r5390 r5395  
    99class Radar : GameObject 
    1010{ 
    11     private GameObject planet; 
    12     private GameObject ship; 
     11    private GameObject mapObject; 
     12    private GameObject shipObject; 
    1313    Proto236b parent; 
    1414    public Radar(Proto236b parent) 
    15         : base(200, 200) 
     15        : base(200 / parent.Camera.ZoomFactor, 200 / parent.Camera.ZoomFactor) 
    1616    { 
    1717        this.parent = parent; 
     
    2222        { 
    2323            //planet radar 
    24             this.planet = new GameObject(133, 133); 
    25             planet.Shape = Shape.Circle; 
    26             Add(planet); 
    27             this.ship = new GameObject(15, 15); 
    28             ship.Animation = new Animation(parent.ImageLists["HUD_ship"]); 
     24            this.mapObject = new GameObject(133 / parent.Camera.ZoomFactor, 133 / parent.Camera.ZoomFactor); 
     25            mapObject.Shape = Shape.Circle; 
     26            Add(mapObject); 
     27            this.shipObject = new GameObject(15 / parent.Camera.ZoomFactor, 15 / parent.Camera.ZoomFactor); 
     28            shipObject.Animation = new Animation(parent.ImageLists["HUD_ship"]); 
    2929            this.Animation.FPS = 3; 
    3030            this.Animation.Start(); 
    31             Add(ship); 
     31            Add(shipObject); 
    3232        } 
    3333        else 
    3434        { 
    3535            //space radar 
     36            this.mapObject = new GameObject(180 / parent.Camera.ZoomFactor, 180 / parent.Camera.ZoomFactor); 
     37            Add(mapObject); 
    3638        } 
    3739    } 
    3840    public override void Update(Time time) 
    3941    { 
    40         this.ship.X = 0; 
    41         this.ship.Y = 0; 
    42         double length = ((parent.Player.Y-(parent.Level.Bottom+parent.Level.Height/2))/parent.Level.Height)*22+66; 
    43         Angle shipAngle = Angle.FromRadians((Math.PI*2)*((parent.Player.X+parent.Level.Width/2)/parent.Level.Width)); 
    44         this.ship.Position += Vector.FromLengthAndAngle(length,Angle.FromRadians(0.9721)+shipAngle); 
     42        if (this.parent.CurrentLevel.IsPlanet) 
     43        { 
     44            this.shipObject.X = 0; 
     45            this.shipObject.Y = 0; 
     46            //jos haluaa joku selityksen näille kahdelle niin selitän mielelläni T:Mikko 
     47            double length = ((parent.Player.Y - (parent.Level.Top - 150 * 40)) / parent.Level.Width) * 40 + 67; 
     48            Angle shipAngle = Angle.FromRadians((Math.PI * 2) * ((parent.Player.X + parent.Level.Width / 2) / parent.Level.Width)); 
     49            this.shipObject.Position += Vector.FromLengthAndAngle(length, shipAngle); 
     50        } 
    4551        base.Update(time); 
    4652    } 
Note: See TracChangeset for help on using the changeset viewer.