public void Move(GameObject obj, ShipUpdateInfo info)
        {
            //Get the direction from the player (controller)
            Vector2 direction = player.input.ShipMoveDirNormal();

            //Check is the player is trying to move
            //Since update (GameObject) will try and move the ship
            //if player is not trying to move we flag it false
            if (direction.X == 0 && direction.Y == 0)
            {
                obj.moving = false;
            }
            else
            {
                obj.moving = true;             //re-flag true in case set to false

                direction.Normalize();         //just in case....
                obj.SetRotation(direction);

                //Since SetRotation() above, also turns the "face" direction
                //we need to correct this for the human players whose ships
                //always face directly upwards on the screen
                obj.SetFaceDir(VecUtil.GetNormUP());
            }
        }
        public void Move(GameObject obj, ShipUpdateInfo info)
        {
            int time = info.gameTime.ElapsedGameTime.Milliseconds;

            elapsed -= time;

            angle = (double)time * rotateSpeed * sign;

            if (elapsed <= 0)    //time to change direction
            {
                sign   *= -1;    //flip sign
                elapsed = clock; //reset clock
            }
            if (obj.position.Y > (info.viewport.Top + 500))
            {
                dir.X += (float)0.002 * info.gameTime.ElapsedGameTime.Milliseconds * sign;

                obj.SetRotation(dir);
                obj.speed = 0.35;

                if (dir.X > sign)
                {
                    dir.X = 1;
                    return;
                }
                return;
            }

            obj.Rotate((float)angle);
        }
        public void Move(GameObject obj, ShipUpdateInfo info)
        {
            if (done)   //performance reasons
                return;

            done = true;
            obj.SetRotation(dir);
        }
        public void Move(GameObject obj, ShipUpdateInfo info)
        {
            timer.Update(info.gameTime);

            switch (timer.Current)
            {
            case Timer2.TimerNum.First:
                obj.SetRotation(VecUtil.GetNormLeft());
                break;

            case Timer2.TimerNum.Second:
                obj.SetRotation(VecUtil.GetNormRight());
                break;
            }

            obj.SetFaceDir(VecUtil.GetNormDown());
        }
        public void Move(GameObject obj, ShipUpdateInfo info)
        {
            if (done)   //performance reasons
            {
                return;
            }

            done = true;
            obj.SetRotation(dir);
        }
        public void Move(GameObject obj, ShipUpdateInfo info)
        {
            switch (state)
            {
            case status.linearDown:
                if (obj.position.Y > (info.viewport.Center.Y + 100))
                {
                    state = status.upTurn;
                }

                break;

            case status.linearUp:
                break;

            case status.upTurn:

                if (turnRad > 180)
                {
                    obj.SetRotation(new Vector2(-1, -1));
                    state = status.linearUp;
                }


                turnRad += (float)0.2 * info.gameTime.ElapsedGameTime.Milliseconds;
                obj.SetRotation(MathHelper.ToRadians(turnRad));
                obj.speed = 0.3;



                break;

            case status.downTurn:

                break;

            case status.End:

                break;
            }
        }
        public void Move(GameObject obj, ShipUpdateInfo info)
        {
            if (done)
            {
                return;
            }

            if (obj.position.X > (info.viewport.Left + 100) &&
                obj.position.X < (info.viewport.Right - 100))
            {
                done = true;
                obj.SetRotation(VecUtil.GetNormDown());
            }
        }
        private int step = 0;   //the chance in Y during the last update


        //Provide the texture name for this level's Background
        //Provide the rectangle in screen coordinates where this background
        //  will be drawn, and also used for window size to match destination
        public LevelSlider(Textures.TextureName background, Rectangle destination)
            : base(background)
        {
            viewport = destination;
            center   = new Vector2((float)viewport.X + (float)viewport.Width / 2.0f,
                                   (float)viewport.Y + (float)viewport.Height / 2.0f);
            midTop    = new Vector2(center.X, (float)viewport.Top);
            midBottom = new Vector2(center.X, (float)viewport.Bottom);

            //the window does not need a texture since we are only using
            //it as a rectangle that moves during update
            window = new GameObject(Textures.TextureName.NullImage);
            window.SetRotation(new Vector2(0, -1));
            window.speed = 0.03f;
        }
        public void Move(GameObject obj, ShipUpdateInfo info)
        {
            if (obj.position.Y > (info.viewport.Top + Y_trigger))
            {
                dir.X += (float)0.002 * info.gameTime.ElapsedGameTime.Milliseconds * sign;

                obj.SetRotation(dir);
                obj.speed = speed;

                if (dir.X > sign)
                {
                    dir.X = 1;
                    return;
                }
            }
        }
Esempio n. 10
0
        public void Move(GameObject obj, ShipUpdateInfo info)
        {
            int time = info.gameTime.ElapsedGameTime.Milliseconds;
            elapsed -= time;

            angle = (double)time * rotateSpeed * sign;

            if (elapsed <= 0)   //time to change direction
            {
                sign *= -1;         //flip sign
                elapsed = clock;    //reset clock
            }
            if (obj.position.Y > (info.viewport.Top + 500))
            {

                dir.X += (float)0.002 * info.gameTime.ElapsedGameTime.Milliseconds * sign;

                obj.SetRotation(dir);
                obj.speed = 0.35;

                if (dir.X > sign)
                {
                    dir.X = 1;
                    return;
                }
                return;
            }

            obj.Rotate((float)angle);
        }
Esempio n. 11
0
        public void Move(GameObject obj, ShipUpdateInfo info)
        {
            //Get the direction from the player (controller)
            Vector2 direction = player.input.ShipMoveDirNormal();

            //Check is the player is trying to move
            //Since update (GameObject) will try and move the ship
            //if player is not trying to move we flag it false
            if (direction.X == 0 && direction.Y == 0)
                obj.moving = false;
            else
            {
                obj.moving = true;             //re-flag true in case set to false

                direction.Normalize();          //just in case....
                obj.SetRotation(direction);

                //Since SetRotation() above, also turns the "face" direction
                //we need to correct this for the human players whose ships
                //always face directly upwards on the screen
                obj.SetFaceDir(VecUtil.GetNormUP());
            }
        }
Esempio n. 12
0
        public void Move(GameObject obj, ShipUpdateInfo info)
        {
            switch (state)
            {
                case status.linearDown:
                    if (obj.position.Y > (info.viewport.Center.Y + 100))
                        state = status.upTurn;

                    break;

                case status.linearUp:
                    break;

                case status.upTurn:

                    if (turnRad > 180)
                    {
                        obj.SetRotation(new Vector2(-1,-1) );
                        state = status.linearUp;
                    }

                    turnRad += (float)0.2*info.gameTime.ElapsedGameTime.Milliseconds;
                    obj.SetRotation(MathHelper.ToRadians(turnRad) );
                    obj.speed = 0.3;

                    break;

                case status.downTurn:

                    break;

                case status.End:

                    break;

            }
        }
Esempio n. 13
0
        public void Move(GameObject obj, ShipUpdateInfo info)
        {
            timer.Update(info.gameTime);

            switch (timer.Current)
            {
                case Timer2.TimerNum.First:
                    obj.SetRotation(VecUtil.GetNormLeft());
                    break;

                case Timer2.TimerNum.Second:
                    obj.SetRotation(VecUtil.GetNormRight());
                    break;
            }

            obj.SetFaceDir(VecUtil.GetNormDown());
        }
Esempio n. 14
0
        public void Move(GameObject obj, ShipUpdateInfo info)
        {
            if (done)
                return;

            if (obj.position.X > (info.viewport.Left + 100) &&
                obj.position.X < (info.viewport.Right - 100))
            {
                done = true;
                obj.SetRotation(VecUtil.GetNormDown());
            }
        }
Esempio n. 15
0
        public void Move(GameObject obj, ShipUpdateInfo info)
        {
            if (obj.position.Y > (info.viewport.Top + Y_trigger))
            {

                dir.X += (float)0.002 * info.gameTime.ElapsedGameTime.Milliseconds * sign;

                obj.SetRotation(dir);
                obj.speed = speed;

                if (dir.X > sign)
                {
                    dir.X = 1;
                    return;

                }
            }
        }