コード例 #1
0
        private void LoadSpriteFonts(SpriteShip ship, Font fontID, Font fontName, Font fontAccel, Font fontResistance, Font fontSpecial)
        {
            fontID.Position.X = ship.X;
            fontID.Position.Y = ship.Y + 42;

            fontName.Position.X = ship.X;
            fontName.Position.Y = ship.Y + 57;

            fontAccel.Position.X = ship.X;
            fontAccel.Position.Y = ship.Y + 72;

            fontResistance.Position.X = ship.X;
            fontResistance.Position.Y = ship.Y + 82;

            fontSpecial.Position.X = ship.X;
            fontSpecial.Position.Y = ship.Y + 92;

            fontAccel.Text      = "Acel: {0}m/s²";
            fontResistance.Text = "Resistência: {0}";
            fontSpecial.Text    = "Especial: {0}";

            fontID.Text         = ship.ID;
            fontName.Text       = ship.Name;
            fontAccel.Text      = string.Format(fontAccel.Text, ship.AccelMpS);
            fontResistance.Text = string.Format(fontResistance.Text, Convert.ToDouble(ship.Resistance).ToString("0.00"));
            fontSpecial.Text    = string.Format(fontSpecial.Text, ship.Special);
        }
コード例 #2
0
        public override void LoadSpriteList()
        {
            this.ship1  = new SpriteShip(Enum.Ships.Type01, 32, 32);
            this.ship2  = new SpriteShip(Enum.Ships.Type02, 32, 32);
            this.ship3  = new SpriteShip(Enum.Ships.Type03, 32, 32);
            this.ship4  = new SpriteShip(Enum.Ships.Type04, 32, 32);
            this.ship5  = new SpriteShip(Enum.Ships.Type05, 32, 32);
            this.ship6  = new SpriteShip(Enum.Ships.Type06, 32, 32);
            this.ship7  = new SpriteShip(Enum.Ships.Type07, 32, 32);
            this.ship8  = new SpriteShip(Enum.Ships.Type08, 32, 32);
            this.ship9  = new SpriteShip(Enum.Ships.Type09, 32, 32);
            this.shipX1 = new SpriteShip(Enum.Ships.TypeX1, 32, 32);
            this.cursor = new Sprite(16, 16, "Images\\Misc\\HMenuCursor");

            this.SpriteList = new List <Sprite>();

            this.SpriteList.Add(this.ship1);
            this.SpriteList.Add(this.ship2);
            this.SpriteList.Add(this.ship3);
            this.SpriteList.Add(this.ship4);
            this.SpriteList.Add(this.ship5);
            this.SpriteList.Add(this.ship6);
            this.SpriteList.Add(this.ship7);
            this.SpriteList.Add(this.ship8);
            this.SpriteList.Add(this.ship9);
            this.SpriteList.Add(this.shipX1);
            this.SpriteList.Add(this.cursor);
        }
コード例 #3
0
        public static void MoveSpeedBarToLZ(SpriteShip Ship, ref Bar BarSpeed, int Multiplier)
        {
            Globals.RelativeVelocity = Functions.CalculateRelativeVelocityToSprite(Globals.SelectedShip, Globals.SelectedStage.SpriteLZ);
            int t = (int)(Globals.RelativeVelocity * Multiplier);

            if (t > BarSpeed.MaxValue)
            {
                BarSpeed.Value = BarSpeed.MaxValue;
            }
            else
            {
                BarSpeed.Value = t;
            }

            if (Globals.RelativeVelocity > Ship.Resistance)
            {
                if ((BarSpeed.ForeColor == BarSpeed.ForeColorDefault || BarSpeed.ForeColor == Color.White) && BarSpeed.FlickCount == 4)
                {
                    BarSpeed.ForeColor  = Color.Red;
                    BarSpeed.FlickCount = 0;
                }
                else if (BarSpeed.ForeColor == Color.Red && BarSpeed.FlickCount == 4)
                {
                    BarSpeed.ForeColor  = Color.White;
                    BarSpeed.FlickCount = 0;
                }

                BarSpeed.FlickCount++;
            }
            else
            {
                BarSpeed.ForeColor = BarSpeed.ForeColorDefault;
            }
        }
コード例 #4
0
 public static void MoveShipSprites(SpriteShip ship)
 {
     Functions.MoveSprite(ship);
     Functions.MoveSprite(ship.SpriteBotton, (int)ship.X, (int)ship.Y + ship.Height);
     Functions.MoveSprite(ship.SpriteRight, (int)ship.X + ship.Width, (int)ship.Y);
     Functions.MoveSprite(ship.SpriteLeft, (int)ship.X - ship.Width, (int)ship.Y);
     Functions.MoveSprite(ship.SpriteTop, (int)ship.X, (int)ship.Y - ship.Height);
 }
コード例 #5
0
ファイル: StarMine.cs プロジェクト: lede701/SharpEngine
        public override void InitializeGame()
        {
            int size = 50000;

            // Setup world
            World.WorldSize.X   = size;
            World.WorldSize.Y   = size;
            World.WorldBoundary = new Rectangle {
                X = 0, Y = 0, Height = size, Width = size
            };
            // Call core Initialzation of game engine
            base.InitializeGame();

            // Create the Universe factory
            UniverseFactory.Instance.AssetPath      = AssetsPath;
            UniverseFactory.Instance.PhysicsFactory = PhysicsFactory;

            float playerX = (float)RandomManager.Instance.Next(1000, (int)World.WorldSize.X - 1000);
            float playerY = (float)RandomManager.Instance.Next(1000, (int)World.WorldSize.Y - 1000);
            //playerX = 5000;
            //playerY = 4000;

            SpriteShip player = UniverseFactory.Instance.CreatePlayer(playerX, playerY);

            player.Controller     = KeyboardController.Instance;
            World.WorldPosition.X = playerX - ((World.ScreenSize.X / 2) - (player.Width * player.Scale.X) / 2);
            World.WorldPosition.Y = playerY - ((World.ScreenSize.Y / 2) - (player.Height * player.Scale.Y) / 2);
            PlayerUI pui = new PlayerUI(ref player.PlayerStats);

            //*
            // Create the universe
            _theUniverse = new UniverseMaster
            {
                BlockSize = new Math.Vector2D {
                    X = World.ScreenSize.X, Y = World.ScreenSize.Y
                }
            };

            // Build player control object
            PlayerController pc = new PlayerController(KeyboardController.Instance);

            KeyboardController.Instance.Map(Input.RightShift, Keys.RShiftKey);
            pc.Player          = player;
            pc.Universe        = _theUniverse;
            player.DebugObject = _theUniverse.DebugObj;
            //*/
            _debug            = new SimpleText("");
            _debug.Position.X = World.ScreenSize.X - 200;
            _debug.Position.Y = 10;

            Add(pc, PLAYERLAYER);
            Add(pui, GUILAYER);
            Add(_debug, GUILAYER);
            InDebugMode = true;
            //Add(player, PLAYERLAYER);
        }
コード例 #6
0
        public static void DecreaseFuel(SpriteShip sprite, Bar FuelBar)
        {
            if (Globals.UpKeyDown || Globals.DownKeyDown || Globals.LeftKeyDown || Globals.RightKeyDown)
            {
                sprite.Fuel -= sprite.FuelConsumptionRate;
            }

            if (Globals.SpaceKeyDown && sprite.UseFuelWhenSpecialKeyDown)
            {
                sprite.Fuel -= sprite.SpecialFuelConsumptionRate;
            }

            if (sprite.Fuel < 0)
            {
                sprite.Fuel = 0;
            }

            if (sprite.Fuel > sprite.MaxFuel)
            {
                sprite.Fuel = sprite.MaxFuel;
            }

            FuelBar.Value = (int)sprite.Fuel;

            if (sprite.Fuel < FuelBar.MaxValue / 5)
            {
                if ((FuelBar.ForeColor == Color.SpringGreen || FuelBar.ForeColor == Color.Purple) && (FuelBar.FlickCount == 2))
                {
                    FuelBar.ForeColor  = Color.Red;
                    FuelBar.FlickCount = 0;
                }
                else if (FuelBar.ForeColor == Color.Red && (FuelBar.FlickCount == 2))
                {
                    FuelBar.ForeColor  = Color.White;
                    FuelBar.FlickCount = 0;
                }
                else if (FuelBar.ForeColor == Color.White && (FuelBar.FlickCount == 2))
                {
                    FuelBar.ForeColor  = Color.Red;
                    FuelBar.FlickCount = 0;
                }
            }
            else if (FuelBar.ForeColor != Color.Purple && (FuelBar.FlickCount == 2))
            {
                FuelBar.ForeColor  = Color.SpringGreen;
                FuelBar.FlickCount = 0;
            }

            FuelBar.FlickCount++;
        }
コード例 #7
0
        public static bool VerifyCollision(SpriteShip sprite, Sprite lz, ref bool landed)
        {
            Globals.CollidedUp    = false;
            Globals.CollidedDown  = false;
            Globals.CollidedLeft  = false;
            Globals.CollidedRight = false;

            if (Globals.CurrentStage != 0)
            {
                Globals.CollidedGround = FunctionsGame.CollidedGround();
            }

            if (Globals.CurrentStage != 0)
            {
                Globals.CollidedLZ = FunctionsGame.CollidedLZ(ref landed);
            }
            //else if (Globals.SelectedStageFreeCollision)
            //{
            //    Globals.CollidedLZ = FunctionsGame.CollidedLZ(ref landed);
            //}


            if (Globals.CollidedGround || Globals.CollidedLZ)
            {
                Globals.Collided = true;

                Globals.SelectedShip.VerticalVelocity   = 0;
                Globals.SelectedShip.HorizontalVelocity = 0;

                Globals.SelectedShip.SpriteTop.Visible    = false;
                Globals.SelectedShip.SpriteBotton.Visible = false;
                Globals.SelectedShip.SpriteLeft.Visible   = false;
                Globals.SelectedShip.SpriteRight.Visible  = false;
            }
            else
            {
                Globals.Collided = false;
            }

            return(Globals.Collided);
        }
コード例 #8
0
        public static int GetShipIndex(SpriteShip sprite)
        {
            int shipIndex = -1;

            switch (Globals.SelectedShip.Ship)
            {
            case Enum.Ships.Type01: shipIndex = 0;
                break;

            case Enum.Ships.Type02: shipIndex = 1;
                break;

            case Enum.Ships.Type03: shipIndex = 2;
                break;

            case Enum.Ships.Type04: shipIndex = 3;
                break;

            case Enum.Ships.Type05: shipIndex = 4;
                break;

            case Enum.Ships.Type06: shipIndex = 5;
                break;

            case Enum.Ships.Type07: shipIndex = 6;
                break;

            case Enum.Ships.Type08: shipIndex = 7;
                break;

            case Enum.Ships.Type09: shipIndex = 8;
                break;

            case Enum.Ships.TypeX1: shipIndex = 9;
                break;
            }

            return(shipIndex);
        }
コード例 #9
0
        public SpriteShip CreatePlayer(float x, float y)
        {
            if (_playerSprite == null)
            {
                String heroPath = String.Format("{0}\\Hero\\fighter.png", AssetPath);
                _playerSprite = GraphicsManager.Instance.LoadSpriteFromImagePath(heroPath);
            }

            SpriteShip ship = new SpriteShip(_playerSprite);

            ship.Position.X    = x;
            ship.Position.Y    = y;
            ship.Position.Type = Math.VectorType.WORLD;
            CircleCollider cc = (CircleCollider)PhysicsFactory.CreateCircleCollider(ship.Position, ship.Width * ship.Scale.X);

            cc.Center         = new Math.Vector2D((ship.Width * ship.Scale.X) / 2f, (ship.Height * ship.Scale.Y) / 2);
            ship.Collider     = cc;
            ship.AlwaysRender = true;


            return(ship);
        }
コード例 #10
0
        public static void ApplyControls(SpriteShip sprite)
        {
            float accel = 0.02F;

            if (Globals.LeftKeyDown)
            {
                if (sprite.CurrentAccelLeft <= sprite.Accel)
                {
                    sprite.CurrentAccelLeft += accel;
                }
                else
                {
                    sprite.CurrentAccelLeft = sprite.Accel;
                }
            }
            else
            {
                sprite.CurrentAccelLeft = sprite.Accel / 3;
            }

            if (Globals.RightKeyDown)
            {
                if (sprite.CurrentAccelRight <= sprite.Accel)
                {
                    sprite.CurrentAccelRight += accel;
                }
                else
                {
                    sprite.CurrentAccelRight = sprite.Accel;
                }
            }
            else
            {
                sprite.CurrentAccelRight = sprite.Accel / 3;
            }

            if (Globals.UpKeyDown)
            {
                if (sprite.CurrentAccelUp <= sprite.Accel)
                {
                    sprite.CurrentAccelUp += accel;
                }
                else
                {
                    sprite.CurrentAccelUp = sprite.Accel;
                }
            }
            else
            {
                sprite.CurrentAccelUp = sprite.Accel / 3;
            }

            if (Globals.DownKeyDown)
            {
                if (sprite.CurrentAccelDown <= sprite.Accel)
                {
                    sprite.CurrentAccelDown += accel;
                }
                else
                {
                    sprite.CurrentAccelDown = sprite.Accel;
                }
            }
            else
            {
                sprite.CurrentAccelDown = sprite.Accel / 3;
            }

            //if (Globals.LeftKeyDown)
            //{
            //    sprite.HorizontalVelocity -= sprite.Accel;
            //}
            //else if (Globals.RightKeyDown)
            //{
            //    sprite.HorizontalVelocity += sprite.Accel;
            //}

            //if (Globals.UpKeyDown)
            //{
            //    sprite.VerticalVelocity -= sprite.Accel;
            //}
            //else if (Globals.DownKeyDown)
            //{
            //    sprite.VerticalVelocity += sprite.Accel;
            //}

            if (Globals.LeftKeyDown)
            {
                sprite.HorizontalVelocity -= sprite.CurrentAccelLeft;
            }
            else if (Globals.RightKeyDown)
            {
                sprite.HorizontalVelocity += sprite.CurrentAccelRight;
            }

            if (Globals.UpKeyDown)
            {
                sprite.VerticalVelocity -= sprite.CurrentAccelUp;
            }
            else if (Globals.DownKeyDown)
            {
                sprite.VerticalVelocity += sprite.CurrentAccelDown;
            }
        }
コード例 #11
0
        public override void Update()
        {
            Functions.KeyReading();

            if (Globals.RightKeyPressed)
            {
                this.currentSelection.X++;

                if (this.currentSelection.X == 3)
                {
                    if (this.currentSelection.Y == 1 || this.currentSelection.Y == 2)
                    {
                        this.currentSelection.X--;
                    }
                }
            }
            else if (Globals.LeftKeyPressed)
            {
                this.currentSelection.X--;
            }
            else if (Globals.UpKeyPressed)
            {
                this.currentSelection.Y--;
            }
            else if (Globals.DownKeyPressed)
            {
                this.currentSelection.Y++;

                if (this.currentSelection.X == 3)
                {
                    if (this.currentSelection.Y == 1 || this.currentSelection.Y == 2)
                    {
                        this.currentSelection.Y--;
                    }
                }
            }
            else if (Globals.EnterKeyPressed)
            {
                if (this.currentShip.Visible)
                {
                    Globals.SFXSelected.Play();
                    Functions.CreateDelay(1);
                    Globals.SelectedShip = this.currentShip;
                    this.LoadShipUpdate();
                    Globals.SaveSelectedShip = Globals.SelectedShip.Ship.ToString();
                    FunctionsGame.SaveGame();
                    Globals.CurrentScene = new SceneTitle();
                }
            }
            else if (Globals.EscKeyPressed)
            {
                Globals.CurrentScene = new SceneTitle();
            }

            if (this.currentSelection.X == 4)
            {
                this.currentSelection.X = 3;
            }

            if (this.currentSelection.Y == 3)
            {
                this.currentSelection.Y = 2;
            }

            if (this.currentSelection.X < 0)
            {
                this.currentSelection.X = 0;
            }

            if (this.currentSelection.Y < 0)
            {
                this.currentSelection.Y = 0;
            }

            this.currentShip = this.selectionGrid[(int)this.currentSelection.X, (int)this.currentSelection.Y];

            this.cursor.Y = this.currentShip.Y + 10;
            this.cursor.X = this.currentShip.X - 20;
        }
コード例 #12
0
        public override void LoadScene()
        {
            base.LoadScene();

            this.ship1.Visible            = true;
            this.fontID01.Visible         = true;
            this.fontName01.Visible       = true;
            this.fontAccel01.Visible      = true;
            this.fontResistance01.Visible = true;
            this.fontSpecial01.Visible    = true;

            this.ship2.Visible            = Globals.SaveShipsAreasCompleted[4, 0];
            this.fontID02.Visible         = Globals.SaveShipsAreasCompleted[4, 0];
            this.fontName02.Visible       = Globals.SaveShipsAreasCompleted[4, 0];
            this.fontAccel02.Visible      = Globals.SaveShipsAreasCompleted[4, 0];
            this.fontResistance02.Visible = Globals.SaveShipsAreasCompleted[4, 0];
            this.fontSpecial02.Visible    = Globals.SaveShipsAreasCompleted[4, 0];
            this.font02Locked.Visible     = !this.ship2.Visible;

            this.ship3.Visible            = Globals.SaveShipsAreasCompleted[4, 1];
            this.fontID03.Visible         = Globals.SaveShipsAreasCompleted[4, 1];
            this.fontName03.Visible       = Globals.SaveShipsAreasCompleted[4, 1];
            this.fontAccel03.Visible      = Globals.SaveShipsAreasCompleted[4, 1];
            this.fontResistance03.Visible = Globals.SaveShipsAreasCompleted[4, 1];
            this.fontSpecial03.Visible    = Globals.SaveShipsAreasCompleted[4, 1];
            this.font03Locked.Visible     = !this.ship3.Visible;

            this.ship4.Visible            = Globals.SaveShipsAreasCompleted[4, 2];
            this.fontID04.Visible         = Globals.SaveShipsAreasCompleted[4, 2];
            this.fontName04.Visible       = Globals.SaveShipsAreasCompleted[4, 2];
            this.fontAccel04.Visible      = Globals.SaveShipsAreasCompleted[4, 2];
            this.fontResistance04.Visible = Globals.SaveShipsAreasCompleted[4, 2];
            this.fontSpecial04.Visible    = Globals.SaveShipsAreasCompleted[4, 2];
            this.font04Locked.Visible     = !this.ship4.Visible;

            this.ship5.Visible            = Globals.SaveShipsAreasCompleted[4, 3];
            this.fontID05.Visible         = Globals.SaveShipsAreasCompleted[4, 3];
            this.fontName05.Visible       = Globals.SaveShipsAreasCompleted[4, 3];
            this.fontAccel05.Visible      = Globals.SaveShipsAreasCompleted[4, 3];
            this.fontResistance05.Visible = Globals.SaveShipsAreasCompleted[4, 3];
            this.fontSpecial05.Visible    = Globals.SaveShipsAreasCompleted[4, 3];
            this.font05Locked.Visible     = !this.ship5.Visible;

            this.ship6.Visible            = Globals.SaveShipsAreasCompleted[4, 4];
            this.fontID06.Visible         = Globals.SaveShipsAreasCompleted[4, 4];
            this.fontName06.Visible       = Globals.SaveShipsAreasCompleted[4, 4];
            this.fontAccel06.Visible      = Globals.SaveShipsAreasCompleted[4, 4];
            this.fontResistance06.Visible = Globals.SaveShipsAreasCompleted[4, 4];
            this.fontSpecial06.Visible    = Globals.SaveShipsAreasCompleted[4, 4];
            this.font06Locked.Visible     = !this.ship6.Visible;

            this.ship7.Visible            = Globals.SaveShipsAreasCompleted[4, 5];
            this.fontID07.Visible         = Globals.SaveShipsAreasCompleted[4, 5];
            this.fontName07.Visible       = Globals.SaveShipsAreasCompleted[4, 5];
            this.fontAccel07.Visible      = Globals.SaveShipsAreasCompleted[4, 5];
            this.fontResistance07.Visible = Globals.SaveShipsAreasCompleted[4, 5];
            this.fontSpecial07.Visible    = Globals.SaveShipsAreasCompleted[4, 5];
            this.font07Locked.Visible     = !this.ship7.Visible;

            this.ship8.Visible            = Globals.SaveShipsAreasCompleted[4, 6];
            this.fontID08.Visible         = Globals.SaveShipsAreasCompleted[4, 6];
            this.fontName08.Visible       = Globals.SaveShipsAreasCompleted[4, 6];
            this.fontAccel08.Visible      = Globals.SaveShipsAreasCompleted[4, 6];
            this.fontResistance08.Visible = Globals.SaveShipsAreasCompleted[4, 6];
            this.fontSpecial08.Visible    = Globals.SaveShipsAreasCompleted[4, 6];
            this.font08Locked.Visible     = !this.ship8.Visible;

            this.ship9.Visible            = Globals.SaveShipsAreasCompleted[4, 7];
            this.fontID09.Visible         = Globals.SaveShipsAreasCompleted[4, 7];
            this.fontName09.Visible       = Globals.SaveShipsAreasCompleted[4, 7];
            this.fontAccel09.Visible      = Globals.SaveShipsAreasCompleted[4, 7];
            this.fontResistance09.Visible = Globals.SaveShipsAreasCompleted[4, 7];
            this.fontSpecial09.Visible    = Globals.SaveShipsAreasCompleted[4, 7];
            this.font09Locked.Visible     = !this.ship9.Visible;

            this.shipX1.Visible = true;

            for (int i = 0; i < 5; i++)
            {
                for (int j = 0; j < 5; j++)
                {
                    if (!Globals.SaveOreCollected[i, j])
                    {
                        this.shipX1.Visible = false;
                    }
                }
            }


            this.fontIDX1.Visible         = this.shipX1.Visible;
            this.fontNameX1.Visible       = this.shipX1.Visible;
            this.fontAccelX1.Visible      = this.shipX1.Visible;
            this.fontResistanceX1.Visible = this.shipX1.Visible;
            this.fontSpecialX1.Visible    = this.shipX1.Visible;
            this.fontX1Locked.Visible     = !this.shipX1.Visible;

            this.currentSelection = new Vector2(0, 0);

            this.selectionGrid[0, 0] = this.ship1;
            this.selectionGrid[1, 0] = this.ship2;
            this.selectionGrid[2, 0] = this.ship3;
            this.selectionGrid[3, 0] = this.ship4;
            this.selectionGrid[0, 1] = this.ship5;
            this.selectionGrid[1, 1] = this.ship6;
            this.selectionGrid[2, 1] = this.ship7;
            this.selectionGrid[0, 2] = this.ship8;
            this.selectionGrid[1, 2] = this.ship9;
            this.selectionGrid[2, 2] = this.shipX1;

            for (int x = 0; x < 4; x++)
            {
                for (int y = 0; y < 3; y++)
                {
                    if (this.selectionGrid[x, y] != null)
                    {
                        SpriteShip s = this.selectionGrid[x, y];

                        if (y == 0)
                        {
                            s.Y = 30;
                        }
                        else
                        {
                            s.Y = this.selectionGrid[x, y - 1].Y + 170;
                        }

                        if (x == 0)
                        {
                            s.X = 30;
                        }
                        else
                        {
                            s.X = this.selectionGrid[x - 1, y].X + 190;
                        }
                    }
                }
            }

            this.LoadSpriteFonts(this.ship1, this.fontID01, this.fontName01, this.fontAccel01, this.fontResistance01, this.fontSpecial01);
            this.LoadSpriteFonts(this.ship2, this.fontID02, this.fontName02, this.fontAccel02, this.fontResistance02, this.fontSpecial02);
            this.LoadSpriteFonts(this.ship3, this.fontID03, this.fontName03, this.fontAccel03, this.fontResistance03, this.fontSpecial03);
            this.LoadSpriteFonts(this.ship4, this.fontID04, this.fontName04, this.fontAccel04, this.fontResistance04, this.fontSpecial04);
            this.LoadSpriteFonts(this.ship5, this.fontID05, this.fontName05, this.fontAccel05, this.fontResistance05, this.fontSpecial05);
            this.LoadSpriteFonts(this.ship6, this.fontID06, this.fontName06, this.fontAccel06, this.fontResistance06, this.fontSpecial06);
            this.LoadSpriteFonts(this.ship7, this.fontID07, this.fontName07, this.fontAccel07, this.fontResistance07, this.fontSpecial07);
            this.LoadSpriteFonts(this.ship8, this.fontID08, this.fontName08, this.fontAccel08, this.fontResistance08, this.fontSpecial08);
            this.LoadSpriteFonts(this.ship9, this.fontID09, this.fontName09, this.fontAccel09, this.fontResistance09, this.fontSpecial09);
            this.LoadSpriteFonts(this.shipX1, this.fontIDX1, this.fontNameX1, this.fontAccelX1, this.fontResistanceX1, this.fontSpecialX1);

            this.font02Locked.Position.X = this.ship2.X;
            this.font02Locked.Position.Y = this.ship2.Y;

            this.font03Locked.Position.X = this.ship3.X;
            this.font03Locked.Position.Y = this.ship3.Y;

            this.font04Locked.Position.X = this.ship4.X;
            this.font04Locked.Position.Y = this.ship4.Y;

            this.font05Locked.Position.X = this.ship5.X;
            this.font05Locked.Position.Y = this.ship5.Y;

            this.font06Locked.Position.X = this.ship6.X;
            this.font06Locked.Position.Y = this.ship6.Y;

            this.font07Locked.Position.X = this.ship7.X;
            this.font07Locked.Position.Y = this.ship7.Y;

            this.font08Locked.Position.X = this.ship8.X;
            this.font08Locked.Position.Y = this.ship8.Y;

            this.font09Locked.Position.X = this.ship9.X;
            this.font09Locked.Position.Y = this.ship9.Y;

            this.fontX1Locked.Position.X = this.shipX1.X;
            this.fontX1Locked.Position.Y = this.shipX1.Y;

            this.fontCommand.Position.X = this.ship4.X;
            this.fontCommand.Position.Y = this.ship4.Y + 230;

            this.fontCommandUp.Position.X = this.ship4.X;
            this.fontCommandUp.Position.Y = this.ship4.Y + 250;

            this.fontCommandDown.Position.X = this.ship4.X;
            this.fontCommandDown.Position.Y = this.ship4.Y + 265;

            this.fontCommandLeft.Position.X = this.ship4.X;
            this.fontCommandLeft.Position.Y = this.ship4.Y + 280;

            this.fontCommandRight.Position.X = this.ship4.X;
            this.fontCommandRight.Position.Y = this.ship4.Y + 295;

            this.fontCommandSpecial.Position.X = this.ship4.X;
            this.fontCommandSpecial.Position.Y = this.ship4.Y + 310;
        }
コード例 #13
0
ファイル: GameMain.cs プロジェクト: lede701/SharpEngine
        public virtual void SetupScene()
        {
            lock (_lock)
            {
                lock (_gfxLock)
                {
                    SceneManager.Clear();
                    // Create a test scene
                    Scene gameScene = new Scene();
                    SceneManager.Add(gameScene);
                    // Create path to sprite sheet
                    String         fileName  = Application.ExecutablePath;
                    Stack <String> pathParts = new Stack <String>(fileName.Split('\\').ToList());
                    // Remove the development paths for now
                    pathParts.Pop();
                    pathParts.Pop();
                    pathParts.Pop();

                    pathName = String.Join("\\", pathParts.Reverse().ToArray());

                    // Put path back together as a string
                    String heroName = String.Format("{0}\\Content\\Hero\\fighter.png", pathName);
                    backName     = String.Format("{0}\\Content\\Backgrounds\\nebula01.jpg", pathName);
                    asteroidName = String.Format("{0}\\Content\\Spritesheets\\asteroid_01.png", pathName);

                    float scale = 0.15f;

                    Sprite hero = new Sprite(heroName);
                    hero.Frames.Add(new Rectangle
                    {
                        X      = 0,
                        Y      = 0,
                        Width  = 405,
                        Height = 488
                    });

                    player = new SpriteShip(hero);

                    player.Position.X = (World.Instance.WorldSize.X / 2) - 12;
                    player.Position.Y = World.Instance.WorldSize.Y - 200f;
                    player.Scale.X    = scale;
                    player.Scale.Y    = scale;
                    player.Velocity.X = 8.0f;
                    player.Velocity.Y = 8.0f;
                    player.Controller = KeyboardController.Instance;
                    player.Type       = ObjectType.PLAYER;

                    PlayerUI plUI = new PlayerUI(ref player.PlayerStats);


                    //*
                    // Create game scene backdrop
                    Sprite back = new Sprite(_gm.LoadImage(backName));
                    SharpDX.Direct2D1.Bitmap backBitmap = (SharpDX.Direct2D1.Bitmap)back.SpriteSheet;
                    back.Frames.Add(new Rectangle {
                        X = 0, Y = 0, Width = (int)backBitmap.Size.Width, Height = (int)backBitmap.Size.Height
                    });
                    SpriteBackdrop bdrop = new SpriteBackdrop(back);

                    SpriteStarField sfield = new SpriteStarField();

                    GameMessage            = new SimpleText("Hello, World!");
                    GameMessage.Position.X = World.Instance.WorldSize.X - 250f;
                    GameMessage.Position.Y = 10;
                    //*/

                    SceneManager.Add(player, 6);
                    SceneManager.Add(GameMessage, 8);
                    SceneManager.Add(plUI, 8);
                    SceneManager.Add(sfield, 2);
                    SceneManager.Add(bdrop, 1);
                }

                if (_spawner == null)
                {
                    _spawner = ThreadManager.CreateThread(Spawn);
                    _spawner.Start();
                }
            }
        }