Beispiel #1
0
        private void UpdateAction()
        {
            if (Globals.SelectedShip.Fuel > 0)
            {
                FunctionsShip.ApplyControls(Globals.SelectedShip);
            }

            Functions.ApplyConstantForce(Globals.SelectedShip, Globals.SelectedStage);
            Functions.ApplyDrag(Globals.SelectedShip, Globals.SelectedStage, Enum.Axis.Horizontal);
            FunctionsShip.MoveShipSprites(Globals.SelectedShip);
            Functions.ApplyStretch(Globals.SelectedShip.SpriteBotton, Enum.Direction.Down, (Globals.SelectedShip.VerticalVelocity * -1) / 6, 32, 64);
            Functions.MoveSprite(Globals.SelectedStage.SpriteLZ);
            Functions.WarpSprite(Globals.SelectedStage.SpriteLZ, Globals.SelectedStage.SpriteAction, Enum.Axis.All);

            if (Globals.CurrentStage == 0)
            {
                Functions.WarpSprite(Globals.SelectedShip, Globals.SelectedStage.SpriteAction, Enum.Axis.All);
            }
            else
            {
                Functions.WarpSprite(Globals.SelectedShip, Globals.SelectedStage.SpriteAction, Enum.Axis.Horizontal);
            }

            FunctionsGame.VerifyCollision(Globals.SelectedShip, Globals.SelectedStage.SpriteLZ, ref Globals.Landed);

            if (Globals.Landed)
            {
                Globals.SFXLanding.Play();
            }
        }
Beispiel #2
0
        protected override void Initialize()
        {
            Globals.Game1        = this;
            this.IsFixedTimeStep = true;
            //this.TargetElapsedTime = new TimeSpan((int)(Globals.TimerInterval * 10));
            //Globals.TimerInterval = (float)(this.TargetElapsedTime.Ticks / 10000);
            this.graphics.PreferredBackBufferWidth  = 800;
            this.graphics.PreferredBackBufferHeight = 600;
            this.spriteBatch = new SpriteBatch(this.GraphicsDevice);
            FunctionsGame.LoadGame();

            Globals.Song         = Content.Load <Song>("Songs\\Intro");
            Globals.SFXCollected = Content.Load <SoundEffect>("Sounds\\collected");
            Globals.SFXCrash     = Content.Load <SoundEffect>("Sounds\\crash");
            Globals.SFXExplosion = Content.Load <SoundEffect>("Sounds\\explosion");
            Globals.SFXFloat     = Content.Load <SoundEffect>("Sounds\\float");
            Globals.SFXLanding   = Content.Load <SoundEffect>("Sounds\\landing");
            Globals.SFXRocket    = Content.Load <SoundEffect>("Sounds\\rocket");
            Globals.SFXSelected  = Content.Load <SoundEffect>("Sounds\\selected");
            Globals.SFXSpecial   = Content.Load <SoundEffect>("Sounds\\special");
            Globals.SFXUnlocked  = Content.Load <SoundEffect>("Sounds\\unlocked");

            Globals.SFXRocketInstance  = Globals.SFXRocket.CreateInstance();
            Globals.SFXFloatInstance   = Globals.SFXFloat.CreateInstance();
            Globals.SFXSpecialInstance = Globals.SFXSpecial.CreateInstance();

            Globals.CurrentScene = new SceneTitle();

            base.Initialize();
        }
Beispiel #3
0
        public override void LoadScene()
        {
            base.LoadScene();

            Globals.ShipsLeft = 2;
            bool unlocked = FunctionsGame.RecordFeatures(Enum.RecordType.UnlockedArea);

            if (unlocked && Globals.CurrentStage == 55 && Globals.SelectedShip.Ship != Enum.Ships.Type09)
            {
                this.message2.Visible = true;
                Globals.SFXUnlocked.Play();
            }
        }
        public override void LoadScene()
        {
            base.LoadScene();

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

            this.selectionGrid[0, 0] = this.location11;
            this.selectionGrid[0, 1] = this.location12;
            this.selectionGrid[0, 2] = this.location13;
            this.selectionGrid[0, 3] = this.location14;
            this.selectionGrid[0, 4] = this.location15;

            this.selectionGrid[1, 0] = this.location21;
            this.selectionGrid[1, 1] = this.location22;
            this.selectionGrid[1, 2] = this.location23;
            this.selectionGrid[1, 3] = this.location24;
            this.selectionGrid[1, 4] = this.location25;

            this.selectionGrid[2, 0] = this.location31;
            this.selectionGrid[2, 1] = this.location32;
            this.selectionGrid[2, 2] = this.location33;
            this.selectionGrid[2, 3] = this.location34;
            this.selectionGrid[2, 4] = this.location35;

            this.selectionGrid[3, 0] = this.location41;
            this.selectionGrid[3, 1] = this.location42;
            this.selectionGrid[3, 2] = this.location43;
            this.selectionGrid[3, 3] = this.location44;
            this.selectionGrid[3, 4] = this.location45;

            this.selectionGrid[4, 0] = this.location51;
            this.selectionGrid[4, 1] = this.location52;
            this.selectionGrid[4, 2] = this.location53;
            this.selectionGrid[4, 3] = this.location54;
            this.selectionGrid[4, 4] = this.location55;

            this.selectionGrid[5, 0] = this.location61;
            this.selectionGrid[5, 1] = this.location62;
            this.selectionGrid[5, 2] = this.location63;
            this.selectionGrid[5, 3] = this.location64;
            this.selectionGrid[5, 4] = this.location65;

            this.selectionGridOre[0, 0] = this.ore11;
            this.selectionGridOre[0, 1] = this.ore12;
            this.selectionGridOre[0, 2] = this.ore13;
            this.selectionGridOre[0, 3] = this.ore14;
            this.selectionGridOre[0, 4] = this.ore15;

            this.selectionGridOre[1, 0] = this.ore21;
            this.selectionGridOre[1, 1] = this.ore22;
            this.selectionGridOre[1, 2] = this.ore23;
            this.selectionGridOre[1, 3] = this.ore24;
            this.selectionGridOre[1, 4] = this.ore25;

            this.selectionGridOre[2, 0] = this.ore31;
            this.selectionGridOre[2, 1] = this.ore32;
            this.selectionGridOre[2, 2] = this.ore33;
            this.selectionGridOre[2, 3] = this.ore34;
            this.selectionGridOre[2, 4] = this.ore35;

            this.selectionGridOre[3, 0] = this.ore41;
            this.selectionGridOre[3, 1] = this.ore42;
            this.selectionGridOre[3, 2] = this.ore43;
            this.selectionGridOre[3, 3] = this.ore44;
            this.selectionGridOre[3, 4] = this.ore45;

            this.selectionGridOre[4, 0] = this.ore51;
            this.selectionGridOre[4, 1] = this.ore52;
            this.selectionGridOre[4, 2] = this.ore53;
            this.selectionGridOre[4, 3] = this.ore54;
            this.selectionGridOre[4, 4] = this.ore55;

            this.selectionGridOre[5, 0] = this.ore61;
            this.selectionGridOre[5, 1] = this.ore62;
            this.selectionGridOre[5, 2] = this.ore63;
            this.selectionGridOre[5, 3] = this.ore64;
            this.selectionGridOre[5, 4] = this.ore65;

            for (int x = 0; x < 6; x++)
            {
                for (int y = 0; y < 5; y++)
                {
                    if (this.selectionGrid[x, y] != null)
                    {
                        Sprite s = this.selectionGrid[x, y].SpriteLocation;

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

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

            for (int x = 0; x < 6; x++)
            {
                for (int y = 0; y < 5; y++)
                {
                    this.selectionGridOre[x, y].Visible = Globals.SaveOreCollected[x, y];
                    this.selectionGridOre[x, y].X       = this.selectionGrid[x, y].SpriteLocation.X;
                    this.selectionGridOre[x, y].Y       = this.selectionGrid[x, y].SpriteLocation.Y + this.selectionGrid[x, y].SpriteLocation.Height - 16;
                }
            }

            this.LoadSpriteFonts(this.location11, this.font11);
            this.LoadSpriteFonts(this.location12, this.font12);
            this.LoadSpriteFonts(this.location13, this.font13);
            this.LoadSpriteFonts(this.location14, this.font14);
            this.LoadSpriteFonts(this.location15, this.font15);

            this.LoadSpriteFonts(this.location11, this.font11);
            this.LoadSpriteFonts(this.location12, this.font12);
            this.LoadSpriteFonts(this.location13, this.font13);
            this.LoadSpriteFonts(this.location14, this.font14);
            this.LoadSpriteFonts(this.location15, this.font15);

            this.LoadSpriteFonts(this.location21, this.font21);
            this.LoadSpriteFonts(this.location22, this.font22);
            this.LoadSpriteFonts(this.location23, this.font23);
            this.LoadSpriteFonts(this.location24, this.font24);
            this.LoadSpriteFonts(this.location25, this.font25);

            this.LoadSpriteFonts(this.location31, this.font31);
            this.LoadSpriteFonts(this.location32, this.font32);
            this.LoadSpriteFonts(this.location33, this.font33);
            this.LoadSpriteFonts(this.location34, this.font34);
            this.LoadSpriteFonts(this.location35, this.font35);

            this.LoadSpriteFonts(this.location41, this.font41);
            this.LoadSpriteFonts(this.location42, this.font42);
            this.LoadSpriteFonts(this.location43, this.font43);
            this.LoadSpriteFonts(this.location44, this.font44);
            this.LoadSpriteFonts(this.location45, this.font45);

            this.LoadSpriteFonts(this.location51, this.font51);
            this.LoadSpriteFonts(this.location52, this.font52);
            this.LoadSpriteFonts(this.location53, this.font53);
            this.LoadSpriteFonts(this.location54, this.font54);
            this.LoadSpriteFonts(this.location55, this.font55);

            this.LoadSpriteFonts(this.location61, this.font61);
            this.LoadSpriteFonts(this.location62, this.font62);
            this.LoadSpriteFonts(this.location63, this.font63);
            this.LoadSpriteFonts(this.location64, this.font64);
            this.LoadSpriteFonts(this.location65, this.font65);

            int gap = 45;

            this.fontArea1.Position.X = this.location11.SpriteLocation.X;
            this.fontArea1.Position.Y = this.location11.SpriteLocation.Y - gap;

            this.fontArea2.Position.X = this.location21.SpriteLocation.X;
            this.fontArea2.Position.Y = this.location21.SpriteLocation.Y - gap;

            this.fontArea3.Position.X = this.location31.SpriteLocation.X;
            this.fontArea3.Position.Y = this.location31.SpriteLocation.Y - gap;

            this.fontArea4.Position.X = this.location41.SpriteLocation.X;
            this.fontArea4.Position.Y = this.location41.SpriteLocation.Y - gap;

            this.fontArea5.Position.X = this.location51.SpriteLocation.X;
            this.fontArea5.Position.Y = this.location51.SpriteLocation.Y - gap;

            this.fontArea6.Position.X = this.location61.SpriteLocation.X;
            this.fontArea6.Position.Y = this.location61.SpriteLocation.Y - gap;

            int shipIndex = FunctionsGame.GetShipIndex(Globals.SelectedShip);

            this.location21.SpriteLocation.Visible = Globals.SaveShipsAreasCompleted[0, shipIndex];
            this.location22.SpriteLocation.Visible = Globals.SaveShipsAreasCompleted[0, shipIndex];
            this.location23.SpriteLocation.Visible = Globals.SaveShipsAreasCompleted[0, shipIndex];
            this.location24.SpriteLocation.Visible = Globals.SaveShipsAreasCompleted[0, shipIndex];
            this.location25.SpriteLocation.Visible = Globals.SaveShipsAreasCompleted[0, shipIndex];

            this.location31.SpriteLocation.Visible = Globals.SaveShipsAreasCompleted[1, shipIndex];
            this.location32.SpriteLocation.Visible = Globals.SaveShipsAreasCompleted[1, shipIndex];
            this.location33.SpriteLocation.Visible = Globals.SaveShipsAreasCompleted[1, shipIndex];
            this.location34.SpriteLocation.Visible = Globals.SaveShipsAreasCompleted[1, shipIndex];
            this.location35.SpriteLocation.Visible = Globals.SaveShipsAreasCompleted[1, shipIndex];

            this.location41.SpriteLocation.Visible = Globals.SaveShipsAreasCompleted[2, shipIndex];
            this.location42.SpriteLocation.Visible = Globals.SaveShipsAreasCompleted[2, shipIndex];
            this.location43.SpriteLocation.Visible = Globals.SaveShipsAreasCompleted[2, shipIndex];
            this.location44.SpriteLocation.Visible = Globals.SaveShipsAreasCompleted[2, shipIndex];
            this.location45.SpriteLocation.Visible = Globals.SaveShipsAreasCompleted[2, shipIndex];

            this.location51.SpriteLocation.Visible = Globals.SaveShipsAreasCompleted[3, shipIndex];
            this.location52.SpriteLocation.Visible = Globals.SaveShipsAreasCompleted[3, shipIndex];
            this.location53.SpriteLocation.Visible = Globals.SaveShipsAreasCompleted[3, shipIndex];
            this.location54.SpriteLocation.Visible = Globals.SaveShipsAreasCompleted[3, shipIndex];
            this.location55.SpriteLocation.Visible = Globals.SaveShipsAreasCompleted[3, shipIndex];

            bool area6Enabled = true;

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

            this.location61.SpriteLocation.Visible = area6Enabled;
            this.location62.SpriteLocation.Visible = area6Enabled;
            this.location63.SpriteLocation.Visible = area6Enabled;
            this.location64.SpriteLocation.Visible = area6Enabled;
            this.location65.SpriteLocation.Visible = area6Enabled;

            this.font21.Visible = this.location21.SpriteLocation.Visible;
            this.font22.Visible = this.location22.SpriteLocation.Visible;
            this.font23.Visible = this.location23.SpriteLocation.Visible;
            this.font24.Visible = this.location24.SpriteLocation.Visible;
            this.font25.Visible = this.location25.SpriteLocation.Visible;

            this.font31.Visible = this.location31.SpriteLocation.Visible;
            this.font32.Visible = this.location32.SpriteLocation.Visible;
            this.font33.Visible = this.location33.SpriteLocation.Visible;
            this.font34.Visible = this.location34.SpriteLocation.Visible;
            this.font35.Visible = this.location35.SpriteLocation.Visible;

            this.font41.Visible = this.location41.SpriteLocation.Visible;
            this.font42.Visible = this.location42.SpriteLocation.Visible;
            this.font43.Visible = this.location43.SpriteLocation.Visible;
            this.font44.Visible = this.location44.SpriteLocation.Visible;
            this.font45.Visible = this.location45.SpriteLocation.Visible;

            this.font51.Visible = this.location51.SpriteLocation.Visible;
            this.font52.Visible = this.location52.SpriteLocation.Visible;
            this.font53.Visible = this.location53.SpriteLocation.Visible;
            this.font54.Visible = this.location54.SpriteLocation.Visible;
            this.font55.Visible = this.location55.SpriteLocation.Visible;

            this.font61.Visible = this.location61.SpriteLocation.Visible;
            this.font62.Visible = this.location62.SpriteLocation.Visible;
            this.font63.Visible = this.location63.SpriteLocation.Visible;
            this.font64.Visible = this.location64.SpriteLocation.Visible;
            this.font65.Visible = this.location65.SpriteLocation.Visible;

            if (!this.font21.Visible)
            {
                this.fontArea2.Text  = "Bloqueado";
                this.fontArea2.Color = Color.White;
            }

            if (!this.font31.Visible)
            {
                this.fontArea3.Text  = "Bloqueado";
                this.fontArea3.Color = Color.White;
            }

            if (!this.font41.Visible)
            {
                this.fontArea4.Text  = "Bloqueado";
                this.fontArea4.Color = Color.White;
            }

            if (!this.font51.Visible)
            {
                this.fontArea5.Text  = "Bloqueado";
                this.fontArea5.Color = Color.White;
            }

            if (!this.font61.Visible)
            {
                this.fontArea6.Text  = "Bloqueado";
                this.fontArea6.Color = Color.White;
            }

            Globals.SelectedStage = this.selectionGrid[0, 0];
        }
Beispiel #5
0
        public override void Update()
        {
            Functions.KeyReading();

            if (Globals.EscKeyPressed)
            {
                if (Globals.GameType == Enum.GameType.Arcade)
                {
                    Globals.CurrentScene = new SceneChooseArea();
                }
                else
                {
                    Globals.CurrentScene = new SceneChooseStage();
                }
            }

            Functions.ApplyPause(!Globals.Collided, this.FontMessage1);
            FunctionsGame.JumpStage();

            if (Globals.Collided)
            {
                Globals.SelectedShip.SpriteTop.Visible    = false;
                Globals.SelectedShip.SpriteBotton.Visible = false;
                Globals.SelectedShip.SpriteLeft.Visible   = false;
                Globals.SelectedShip.SpriteRight.Visible  = false;

                if (!Globals.Landed)
                {
                    Functions.ShowMessage(this.FontMessage1, Color.Red, "Colidiu!");
                    Functions.ShowMessage(this.FontMessage2, Color.Red, "Pressione Enter para continuar...");
                }
                else
                {
                    Functions.ShowMessage(this.FontMessage1, Color.LimeGreen, "Pousou!");
                    Functions.ShowMessage(this.FontMessage2, Color.LimeGreen, "Pressione Enter para continuar...");
                }

                Functions.CenterFont(this.FontMessage1, Globals.SelectedStage.SpriteAction);
                Functions.CenterFont(this.FontMessage2, Globals.SelectedStage.SpriteAction);

                FunctionsGame.ApplyPostStage();
            }
            else
            {
                if (!Globals.Paused)
                {
                    if (!Globals.EndedIntro)
                    {
                        this.UpdateIntro();
                    }
                    else
                    {
                        this.UpdateAction();

                        Globals.UpdateLander.Invoke();

                        Globals.UpdateArea.Invoke();

                        Globals.UpdateOre.Invoke();

                        FunctionsStage.UpdateStage();
                    }
                }
            }
        }
        public override void LoadScene()
        {
            base.LoadScene();

            Globals.ShipsLeft = 2;

            this.areas    = new Sprite[6];
            this.areas[0] = this.area1;
            this.areas[1] = this.area2;
            this.areas[2] = this.area3;
            this.areas[3] = this.area4;
            this.areas[4] = this.area5;
            this.areas[5] = this.area6;

            int x   = 50;
            int gap = 5;

            this.area1.X = x;
            this.area1.Y = 20;

            this.area2.X = x;
            this.area2.Y = this.area1.Y + this.area1.Height + gap;

            this.area3.X = x;
            this.area3.Y = this.area2.Y + this.area2.Height + gap;

            this.area4.X = x;
            this.area4.Y = this.area3.Y + this.area3.Height + gap;

            this.area5.X = x;
            this.area5.Y = this.area4.Y + this.area4.Height + gap;

            this.area6.X = x;
            this.area6.Y = this.area5.Y + this.area5.Height + gap;

            this.area1Clear.X = this.area1.X + this.area1.Width + 5;
            this.area1Clear.Y = this.area1.Y + 10;

            this.area2Clear.X = this.area2.X + this.area2.Width + 5;
            this.area2Clear.Y = this.area2.Y + 10;

            this.area3Clear.X = this.area3.X + this.area3.Width + 5;
            this.area3Clear.Y = this.area3.Y + 10;

            this.area4Clear.X = this.area4.X + this.area4.Width + 5;
            this.area4Clear.Y = this.area4.Y + 10;

            this.area5Clear.X = this.area5.X + this.area5.Width + 5;
            this.area5Clear.Y = this.area5.Y + 10;

            this.area6Clear.X = this.area6.X + this.area6.Width + 5;
            this.area6Clear.Y = this.area6.Y + 10;

            this.cursor.X = this.area1.X - 40;
            this.cursor.Y = this.area1.Y + this.cursorYGap;

            int gapLocked = 20;

            this.font2Locked.Position.X = this.area2.X;
            this.font2Locked.Position.Y = this.area2.Y + gapLocked;

            this.font3Locked.Position.X = this.area3.X;
            this.font3Locked.Position.Y = this.area3.Y + gapLocked;

            this.font4Locked.Position.X = this.area4.X;
            this.font4Locked.Position.Y = this.area4.Y + gapLocked;

            this.font5Locked.Position.X = this.area5.X;
            this.font5Locked.Position.Y = this.area5.Y + gapLocked;

            this.font6Locked.Position.X = this.area6.X;
            this.font6Locked.Position.Y = this.area6.Y + gapLocked;

            int shipIndex = FunctionsGame.GetShipIndex(Globals.SelectedShip);

            this.area2.Visible = Globals.SaveShipsAreasCompleted[0, shipIndex];
            this.area3.Visible = Globals.SaveShipsAreasCompleted[1, shipIndex];
            this.area4.Visible = Globals.SaveShipsAreasCompleted[2, shipIndex];
            this.area5.Visible = Globals.SaveShipsAreasCompleted[3, shipIndex];

            this.area1Clear.Visible = Globals.SaveShipsAreasCompleted[0, shipIndex];
            this.area2Clear.Visible = Globals.SaveShipsAreasCompleted[1, shipIndex];
            this.area3Clear.Visible = Globals.SaveShipsAreasCompleted[2, shipIndex];
            this.area4Clear.Visible = Globals.SaveShipsAreasCompleted[3, shipIndex];
            this.area5Clear.Visible = Globals.SaveShipsAreasCompleted[4, shipIndex];
            this.area6Clear.Visible = Globals.SaveShipsAreasCompleted[5, shipIndex];

            bool area6Enabled = true;

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

            this.area6.Visible = area6Enabled;

            this.font2Locked.Visible = !this.area2.Visible;
            this.font3Locked.Visible = !this.area3.Visible;
            this.font4Locked.Visible = !this.area4.Visible;
            this.font5Locked.Visible = !this.area5.Visible;
            this.font6Locked.Visible = !this.area6.Visible;
        }
        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;
        }