source: 2014/27/AleksanteriV/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/Radar.cs @ 5369

Revision 5369, 1.1 KB checked in by mijoilmo, 9 years ago (diff)
Line 
1using System;
2using System.Collections.Generic;
3using Jypeli;
4using Jypeli.Assets;
5using Jypeli.Controls;
6using Jypeli.Effects;
7using Jypeli.Widgets;
8
9class Radar : GameObject
10{
11    private GameObject planet;
12    private GameObject ship;
13    Proto236b parent;
14    public Radar(Proto236b parent)
15        : base(200, 200)
16    {
17        this.parent = parent;
18        this.Image = parent.Images["HUD_radar"];
19        if (parent.CurrentLevel.IsPlanet)
20        {
21            //planet radar
22            this.planet = new GameObject(100, 100);
23            planet.Shape = Shape.Circle;
24            Add(planet);
25            this.ship = new GameObject(10, 10);
26            ship.Color = Color.Red;
27            Add(ship);
28        }
29        else
30        {
31            //space radar
32        }
33    }
34    public override void Update(Time time)
35    {
36        this.ship.X = 0;
37        this.ship.Y = 0;
38        double length = (parent.Player.Y - parent.Level.Bottom)/parent.Level.Height * 20 + 40;
39        this.ship.Position += Vector.FromLengthAndAngle(length,Angle.RightAngle);
40        base.Update(time);
41    }
42}
Note: See TracBrowser for help on using the repository browser.