예제 #1
0
 public override void Added()
 {
     base.Added();
     for (int x = 0; x < 5; x++)
     {
         World.Add(new Asteroid(FP.Rand(SectorSize) + X, FP.Rand(SectorSize) + Y, SpaceWorld.WorldLength, SpaceWorld.WorldHeight));
     }
 }
예제 #2
0
        public Asteroid(float x, float y, uint right, uint bottom)
            : base(x, y, right, bottom)
        {
            vel.X   = FP.Rand(100) * FP.Choose(1, -1);
            vel.Y   = FP.Rand(100) * FP.Choose(1, -1);
            rot     = FP.Random * (float)90 * FP.Choose(1, -1);
            health += (((Height = Width = (sizeMod = (int)FP.Rand((uint)posSizeMod)) + size) - size) / posSizeMod) * health;
            var AsteroidImage = new Image(Library.GetTexture("Asteroid.png"));

            Graphic = image = AsteroidImage;
            CenterOrigin();
            image.CenterOO();
            Type = "Asteroid";
        }
예제 #3
0
        public override void Begin()
        {
            base.Begin();
            musics       = new Sfx(Library.GetBuffer("BlackVortex.ogg"));
            musics.Pitch = .5f;
            musics.Loop();


            FP.Engine.ClearColor = FP.Color(0x000000);
            for (int x = 0; x < Sectors.GetLength(0) - 1; x++)
            {
                for (int y = 0; y < Sectors.GetLength(1) - 1; y++)
                {
                    Sectors[x, y]   = new SpaceSector();
                    Sectors[x, y].X = x * Sectors[x, y].Width;
                    Sectors[x, y].Y = y * Sectors[x, y].Height;
                    Add(Sectors[x, y]);
                }
            }
            var e = Add(PlayerShip = new Ship());

            Add(new Part(e, 1, 0, 0));
            for (int i = 0; i < 5; i++)
            {
                Part n = new Part(1);
                n.X = FP.Rand(800);
                n.Y = FP.Rand(800);
                Part nn = new Part(2);
                nn.X = FP.Rand(800);
                nn.Y = FP.Rand(800);
                Add(n);
                Add(nn);
            }
            Add(new Part(e, 3, 0, 0));
            for (int i = 0; i < 30; i++)
            {
                Add(new EmptyShip());
            }

            //FP.Log(WorldHeight);
            //Input.ControllerConnected += (s, e) => Add(new JoystickGuy(e.JoystickId));
            //Input.Pressed(Mouse.Button.Left);
        }
예제 #4
0
 public override void Update()
 {
     base.Update();
     background.Color = FP.Color(FP.Rand(uint.MaxValue));
 }