Exemple #1
0
        /// <summary>
        /// Updates the screen with specified deltaTime.
        /// </summary>
        /// <param name="deltaTime">Delta time.</param>
        public override void Update(float deltaTime)
        {
            IGraphics         g           = Game.Graphics;
            List <TouchEvent> touchEvents = Game.Input.TouchEvents;

            foreach (var te in touchEvents)
            {
                if (te.type == TouchEvent.TOUCH_UP)
                {
                    bool wasClicked = gBut.Clicked(te);

                    if (wasClicked)
                    {
                        Game.CurrentScreen = new GameScreen(Game);
                    }
                }
            }
        }
Exemple #2
0
        private void handleTouchDown(TouchEvent touchEvent)
        {
            //First handles clicks on the shoot, duck and jump buttons
            if (jump.Clicked(touchEvent))
            {
                robot.Jump();
                currentCharacterSprite = PictureManager.Pictures ["character_jumped"];
            }
            else if (duck.Clicked(touchEvent) && !robot.Jumped)
            {
                currentCharacterSprite = PictureManager.Pictures ["character_ducked"];
                robot.Duck();
            }
            else if (shoot.Clicked(touchEvent) && !robot.Ducked && robot.ReadyToFire)
            {
                robot.Shoot();
            }

            //Then handles moving
            if (touchEvent.x > 400)
            {
                robot.MoveRight();
            }
        }