/// <summary>
        /// ProcessEvents, overide method.
        /// </summary>
        public override void ProcessEvents()
        {
            //process item collisions
            if (GameObjects.Items != null)
            {
                for (int i = 0; i < GameObjects.Items.Count; ++i)
                {
                    if (GameObjects.Items[i].Colides(this))
                    {
                        switch (GameObjects.Items[i].ItemType.ToString())
                        {
                        case "BigPower":
                            for (int j = 0; j < 5; ++j)
                            {
                                GameScores.IncrementPower();
                            }
                            if (GameScores.Power < 128)
                            {
                                GameScores.Score += GameScores.Points[0];
                            }
                            else
                            {
                                GameScores.Score += GameScores.Points[GameScores.iterator];
                                for (int k = 0; k < 8; ++k)
                                {
                                    if (GameScores.iterator < 30)
                                    {
                                        GameScores.iterator++;
                                    }
                                }
                            }
                            break;

                        case "Bomb":
                            GameScores.Bomb++;
                            break;

                        case "FullPower":
                            for (int l = 0; l < 128; ++l)
                            {
                                GameScores.IncrementPower();
                            }
                            break;

                        case "Life":
                            GameScores.Player++;
                            break;

                        case "Point":
                            GameScores.Bonus++;
                            break;

                        case "Power":
                            GameScores.IncrementPower();
                            if (GameScores.Power < 128)
                            {
                                GameScores.Score += GameScores.Points[0];
                            }
                            else
                            {
                                GameScores.Score += GameScores.Points[GameScores.iterator];
                                if (GameScores.iterator < 30)
                                {
                                    GameScores.iterator++;
                                }
                            }
                            break;

                        case "Star":
                            GameScores.Score += 500 + (10 * (GameScores.Graze / 3));
                            break;
                        }
                        GameObjects.RemoveItem(GameObjects.Items[i]);
                    }
                }
            }

            PowerLevel();

            if (SwinGame.KeyDown(GameKeys.SHOOT))
            {
                MainCannon();
                AuxCannon();
            }

            ProcessMovement();

            foreach (BulletEntity bullet in _bullets)
            {
                bullet.ProcessEvents();
            }

            for (int i = 0; i < _bullets.Count; ++i)
            {
                if (_bullets[i].Y < 0)
                {
                    _bullets.Remove(_bullets[i]);
                }
            }

            DrawEntity();

            if (_auxLevel > 0)
            {
                SwinGame.DrawBitmap(GameResources.GameImage("YingYang" + (Tick % 64) / 8), (float)(X + 30) - (GameResources.GameImage("YingYang" + (Tick % 64) / 8).Width / 2), (float)Y - (GameResources.GameImage("YingYang" + (Tick % 64) / 8).Height / 2));
                SwinGame.DrawBitmap(GameResources.GameImage("YingYang" + (Tick % 64) / 8), (float)(X - 30) - (GameResources.GameImage("YingYang" + (Tick % 64) / 8).Width / 2), (float)Y - (GameResources.GameImage("YingYang" + (Tick % 64) / 8).Height / 2));
            }

            Tick++;
        }
Exemple #2
0
        public override void ProcessEvents()
        {
            //process item collisions
            if (GameObjects.Items != null)
            {
                for (int i = 0; i < GameObjects.Items.Count; ++i)
                {
                    if (GameObjects.Items[i].Colides(this))
                    {
                        switch (GameObjects.Items[i].ItemType.ToString())
                        {
                        case "BigPower":
                            for (int j = 0; j < 5; ++j)
                            {
                                GameScores.IncrementPower();
                            }
                            if (GameScores.Power < 128)
                            {
                                GameScores.Score += GameScores.Points[0];
                            }
                            else
                            {
                                GameScores.Score += GameScores.Points[GameScores.iterator];
                                for (int k = 0; k < 8; ++k)
                                {
                                    if (GameScores.iterator < 30)
                                    {
                                        GameScores.iterator++;
                                    }
                                }
                            }
                            break;

                        case "Bomb":
                            GameScores.Bomb++;
                            break;

                        case "FullPower":
                            for (int l = 0; l < 128; ++l)
                            {
                                GameScores.IncrementPower();
                            }
                            break;

                        case "Life":
                            GameScores.Player++;
                            break;

                        case "Point":
                            GameScores.Bonus++;
                            break;

                        case "Power":
                            GameScores.IncrementPower();
                            if (GameScores.Power < 128)
                            {
                                GameScores.Score += GameScores.Points[0];
                            }
                            else
                            {
                                GameScores.Score += GameScores.Points[GameScores.iterator];
                                if (GameScores.iterator < 30)
                                {
                                    GameScores.iterator++;
                                }
                            }
                            break;

                        case "Star":
                            GameScores.Score += 500 + (10 * (GameScores.Graze / 3));
                            break;
                        }
                        GameObjects.Items[i].Hitpoints = 0;
                    }
                }
            }

            foreach (BulletEntity bullet in GameObjects.Bullets)
            {
                if (bullet.Owner != this && bullet.Colides(this))
                {
                    Hitpoints       -= bullet.Hitpoints;
                    bullet.Hitpoints = 0;
                }
            }

            Level();

            if (SwinGame.KeyDown(GameKeys.SHOOT))
            {
                Cannon();
            }

            if (SwinGame.KeyDown(GameKeys.BOMB) && GameScores.Bomb > 0 && _coolDown == 0)
            {
                foreach (BulletEntity bullet in GameObjects.Bullets)
                {
                    if (bullet.Owner != this)
                    {
                        GameObjects.AddItem(new ItemEntity(bullet.Position, ItemType.Star));
                        bullet.Hitpoints = 0;
                    }
                }

                foreach (ItemEntity item in GameObjects.Items)
                {
                    item.Flag = true;
                }

                GameScores.Bomb--;
                _coolDown = 60;
            }

            if (Y < 160)
            {
                foreach (ItemEntity item in GameObjects.Items)
                {
                    item.Flag = true;
                }
            }

            ProcessMovement();

            DrawEntity();

            if (_cannonAux > 0)
            {
                SwinGame.DrawBitmap(GameResources.GameImage("YingYang" + (Tick % 64) / 8), (float)(X + 30) - (GameResources.GameImage("YingYang" + (Tick % 64) / 8).Width / 2), (float)Y - (GameResources.GameImage("YingYang" + (Tick % 64) / 8).Height / 2));
                SwinGame.DrawBitmap(GameResources.GameImage("YingYang" + (Tick % 64) / 8), (float)(X - 30) - (GameResources.GameImage("YingYang" + (Tick % 64) / 8).Width / 2), (float)Y - (GameResources.GameImage("YingYang" + (Tick % 64) / 8).Height / 2));
            }

            Tick++;

            if (_coolDown > 0)
            {
                _coolDown--;
            }
        }