Ejemplo n.º 1
0
        public static void JumpStage()
        {
            if (!Globals.JumpStageKeyDown && Globals.JumpStageKeyDownPrevious)
            {
                if (Globals.GameType == Enum.GameType.Arcade)
                {
                    if (Globals.KeyPressDelay > 0)
                    {
                        Globals.KeyPressDelay = 0;
                        FunctionsGame.ChangeStage();
                    }
                    else
                    {
                        Globals.KeyPressDelay++;
                    }
                }
                else if (Globals.GameType == Enum.GameType.OreColleting)
                {
                    if (Globals.KeyPressDelay > 0)
                    {
                        Globals.KeyPressDelay = 0;

                        Globals.Collided = true;
                        Globals.Landed   = true;
                    }
                    else
                    {
                        Globals.KeyPressDelay++;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public static void UpdateStage()
        {
            Globals.SelectedShip.TotalVelocity = Functions.CalculateTotalForce(Globals.SelectedShip);
            FunctionsStage.MoveSpeedBar(Globals.SelectedShip, Globals.SelectedStage.BarSpeed, Globals.SpeedBarMultiplier);
            FunctionsStage.MoveSpeedBarToLZ(Globals.SelectedShip, ref Globals.SelectedStage.BarSpeedToLZ, Globals.SpeedBarMultiplier);
            FunctionsGame.DecreaseFuel(Globals.SelectedShip, Globals.SelectedStage.BarFuel);

            if (Globals.SpaceKeyDown)
            {
                Globals.SelectedStage.SpriteLED.TextureCurrent = Globals.SelectedStage.SpriteLED.Textures[1];
            }
            else
            {
                Globals.SelectedStage.SpriteLED.TextureCurrent = Globals.SelectedStage.SpriteLED.Textures[0];
            }

            if (Globals.SelectedShip.Y < 0 - Globals.SelectedShip.Height)
            {
                Globals.SelectedStage.SpriteCursor.Visible = true;
                Globals.SelectedStage.FontCursor.Visible   = true;
                FunctionsGame.MoveOffMapCursor();
            }
            else
            {
                Globals.SelectedStage.SpriteCursor.Visible = false;
                Globals.SelectedStage.FontCursor.Visible   = false;
            }
        }
Ejemplo n.º 3
0
        public static bool RecordFeatures(Enum.RecordType type)
        {
            bool unlocked = false;

            if (type == Enum.RecordType.SelectedShip)
            {
                Globals.SaveSelectedShip = Globals.SelectedShip.Ship.ToString();
            }
            else if (type == Enum.RecordType.UnlockedArea)
            {
                int shipIndex = FunctionsGame.GetShipIndex(Globals.SelectedShip);
                int areaIndex = -1;

                if (Globals.CurrentStage == 15)
                {
                    areaIndex = 0;
                }
                else if (Globals.CurrentStage == 25)
                {
                    areaIndex = 1;
                }
                else if (Globals.CurrentStage == 35)
                {
                    areaIndex = 2;
                }
                else if (Globals.CurrentStage == 45)
                {
                    areaIndex = 3;
                }
                else if (Globals.CurrentStage == 55)
                {
                    areaIndex = 4;
                }
                else if (Globals.CurrentStage == 65)
                {
                    areaIndex = 5;
                }

                if (Globals.CurrentStage != 65 && Globals.SelectedShip.Ship != Enum.Ships.TypeX1)
                {
                    unlocked = !Globals.SaveShipsAreasCompleted[areaIndex, shipIndex];
                }

                Globals.SaveShipsAreasCompleted[areaIndex, shipIndex] = true;
            }
            else if (type == Enum.RecordType.OreCollected)
            {
                int area  = Convert.ToInt16(Globals.CurrentStage.ToString().Substring(0, 1));
                int stage = Convert.ToInt16(Globals.CurrentStage.ToString().Substring(1, 1));

                Globals.SaveOreCollected[area - 1, stage - 1] = true;
            }

            FunctionsGame.SaveGame();

            return(unlocked);
        }
Ejemplo n.º 4
0
        public static void ApplyPostStage()
        {
            SoundClass.Stop(Globals.SFXRocketInstance);
            SoundClass.Stop(Globals.SFXFloatInstance);

            if (Globals.EnterKeyPressed)
            {
                if (Globals.GameType == Enum.GameType.Arcade)
                {
                    if (Globals.Landed)
                    {
                        FunctionsGame.ChangeStage();
                    }
                    else if (Globals.Collided)
                    {
                        if (Globals.ShipsLeft > 0)
                        {
                            Globals.ShipsLeft--;
                            FunctionsStage.InitializeStage();
                        }
                        else
                        {
                            Globals.CurrentScene = new Scenes.SceneTitle();
                        }
                    }
                }
                else if (Globals.GameType == Enum.GameType.OreColleting)
                {
                    if (Globals.Landed)
                    {
                        if (!Globals.SelectedStage.SpriteRedOre.Visible && !Globals.SelectedStage.SpriteGreenOre.Visible && !Globals.SelectedStage.SpriteBlueOre.Visible)
                        {
                            Globals.OreCollected = true;
                            FunctionsGame.RecordFeatures(Enum.RecordType.OreCollected);
                            Globals.CurrentScene = new Scenes.SceneChooseStage();
                        }
                        else
                        {
                            FunctionsStage.InitializeStage();
                        }
                    }
                    else
                    {
                        FunctionsStage.InitializeStage();
                    }
                }
                else
                {
                    FunctionsStage.InitializeStage();
                }
            }
        }
Ejemplo n.º 5
0
        public static void LoadGame()
        {
            if (!FunctionsGame.ValidateSaveIntegrity())
            {
                CreateNewFile();
            }

            try
            {
                string file = Functions.ReadEncryptedFile(Globals.SaveFilePath);

                string[] newline = { Environment.NewLine };
                string[] comma   = { ";" };

                string[] lines = file.Split(newline, 2000, StringSplitOptions.RemoveEmptyEntries);

                Globals.SaveSelectedShip = lines[0].Replace(";", "");

                //Load Cleared Areas per Ship
                for (int i = 1; i < 7; i++)
                {
                    string[] cells = lines[i].Split(comma, 2000, StringSplitOptions.RemoveEmptyEntries);

                    for (int j = 0; j < cells.Length; j++)
                    {
                        Globals.SaveShipsAreasCompleted[i - 1, j] = Convert.ToBoolean(cells[j]);
                    }
                }

                //Load Ore Colleted per Stage
                for (int i = 7; i < 13; i++)
                {
                    string[] cells = lines[i].Split(comma, 2000, StringSplitOptions.RemoveEmptyEntries);

                    for (int j = 0; j < cells.Length; j++)
                    {
                        Globals.SaveOreCollected[i - 7, j] = Convert.ToBoolean(cells[j]);
                    }
                }
            }
            catch
            {
                CreateNewFile();
            }
        }
Ejemplo n.º 6
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);
        }