Esempio n. 1
0
        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            if (Alive)
            {
                // Will wait a certain time before bringing the ship back on screen.
                if (ship.MovedOut(currentDir))
                {
                    betweenAppearances = new TimeSpan(0, 0, 0, randomize.Next(2, 10));
                    if (gameTime.TotalGameTime - lastAppearance > betweenAppearances)
                    {
                        if (currentDir == Direction.RIGHT)
                        {
                            currentDir = Direction.LEFT;
                        }
                        else
                        {
                            currentDir = Direction.RIGHT;
                        }

                        ship.Move(currentDir);
                    }
                }

                else
                {
                    ship.Move(currentDir);
                    lastAppearance = gameTime.TotalGameTime;
                }

                bomb.Launch(Boundary, gameTime);
            }

            base.Update(gameTime);
        }
Esempio n. 2
0
 /// <summary>
 /// control MotherShip move by mouse move
 /// </summary>
 /// <param name="mousePosition">Mouse cursor location(X, Y)</param>
 public void MouseControll(int mousePosition_X)
 {
     motherShip.Move(mousePosition_X);
 }