示例#1
0
        public void UpdatePosition()
        {
            if (YVelocity > PhysicsUtilites.GlobalGravityCoef * 3 &&
                Koopa is RedKoopa &&
                Koopa.Health == KoopaStateMachine.KoopaHealth.Normal)
            {
                YVelocity = 0;
                float x = (float)(.6 * (XVelocity / XVelocity)) + Koopa.Location.X;
                Koopa.SetPosition(new Vector2(x, Koopa.Location.Y));
                Koopa.ChangeDirection();
            }
            PhysicsUtilites.ClampVelocity((IPhysics)this);
            double xPos = (int)Koopa.Location.X;
            double yPos = (int)Koopa.Location.Y;

            xPos += Math.Round(XVelocity);
            yPos += Math.Round(YVelocity);
            Vector2 pos = ClampPosition(xPos, yPos);

            Koopa.Location             = pos;
            Koopa.DestinationRectangle = new Rectangle((int)pos.X, (int)pos.Y,
                                                       Koopa.DestinationRectangle.Width, Koopa.DestinationRectangle.Height);
            XVelocity  = XVelocity;
            YVelocity += GravityCoef;
        }
示例#2
0
        public void UpdatePosition()
        {
            PhysicsUtilites.ClampVelocity((IPhysics)this);
            double xPos = (int)PiranaPlant.Location.X;
            double yPos = (int)PiranaPlant.Location.Y;

            if (timer == 100)
            {
                YVelocity = YMinVelocity;
            }
            else if (timer == 125)
            {
                YVelocity = 0;
            }
            else if (timer == 225)
            {
                YVelocity = YMaxVelocity;
            }
            else if (timer == 250)
            {
                YVelocity = 0;
                timer     = -1;
            }
            timer++;
            yPos += Math.Round(YVelocity);
            Vector2 pos = ClampPosition(xPos, yPos);

            PiranaPlant.Location             = pos;
            PiranaPlant.DestinationRectangle = new Rectangle((int)pos.X, (int)pos.Y,
                                                             PiranaPlant.DestinationRectangle.Width, PiranaPlant.DestinationRectangle.Height);
        }
示例#3
0
        public void UpdatePosition()
        {
            PhysicsUtilites.ClampVelocity((IPhysics)this);
            double xPos = Block.DestinationRectangle.Location.X;
            double yPos = Block.DestinationRectangle.Location.Y;

            yPos += Math.Round(YVelocity);
            Vector2 pos = PhysicsUtilites.ClampPosition(xPos, yPos, (IPhysics)this);

            Block.Location             = pos;
            Block.DestinationRectangle = new Rectangle((int)pos.X, (int)pos.Y, Block.DestinationRectangle.Width, Block.DestinationRectangle.Height);
            YVelocity += GravityCoef;
        }
示例#4
0
        public void UpdatePosition()
        {
            PhysicsUtilites.ClampVelocity((IPhysics)this);
            double xPos = (int)Goomba.Location.X;
            double yPos = (int)Goomba.Location.Y;

            xPos += Math.Round(XVelocity);
            yPos += Math.Round(YVelocity);
            Vector2 pos = ClampPosition(xPos, yPos);

            Goomba.Location             = pos;
            Goomba.DestinationRectangle = new Rectangle((int)pos.X, (int)pos.Y,
                                                        Goomba.DestinationRectangle.Width, Goomba.DestinationRectangle.Height);
            XVelocity  = XVelocity;
            YVelocity += GravityCoef;
        }
示例#5
0
        public void UpdatePosition()
        {
            PhysicsUtilites.ClampVelocity((IPhysics)this);
            double xPos = Mario.DestinationRectangle.Location.X;
            double yPos = Mario.DestinationRectangle.Location.Y;

            xPos += Math.Round(XVelocity);
            yPos += Math.Round(YVelocity);
            if (yPos > MinPosition.Y)
            {
                Mario.KillMario();
            }
            if (xPos > MaxPosition.X)
            {
                XMinVelocity = PhysicsUtilites.PlayerMinVelocityX;
            }
            if (xPos > PhysicsUtilites.FlagPosition && yPos < 0)
            {
                XVelocity = 0;
                xPos      = PhysicsUtilites.FlagPosition;
            }
            if (xPos > PhysicsUtilites.FlagPosition - 1)
            {
                resetTimer++;
                if (resetTimer >= 500)
                {
                    game.GameReset.Execute();
                    game.toggleCastle = false;
                }
            }
            if (xPos >= PhysicsUtilites.XMaxPosition)
            {
                Mario.DrawInvisibleSprite = true;
                game.toggleCastle         = true;
            }
            else
            {
                game.toggleCastle = false;
            }
            Vector2 pos = PhysicsUtilites.ClampPosition(xPos, yPos, (IPhysics)this);

            Mario.SetPosition(pos);
            XVelocity  = XVelocity * XDampingCoef;
            YVelocity += GravityCoef;
        }
示例#6
0
        public void UpdatePosition()
        {
            PhysicsUtilites.ClampVelocity((IPhysics)this);

            if (IncrementTimer)
            {
                timer++;
            }
            else
            {
                timer--;
            }

            if (timer == delay)
            {
                XVelocity      = XMaxVelocity;
                IncrementTimer = false;
            }
            else if (timer == 0)
            {
                XVelocity      = XMinVelocity;
                IncrementTimer = true;
            }

            jumpTimer++;

            if (jumpTimer == jumpDelay)
            {
                YVelocity = YMaxVelocity;
                jumpTimer = 0;
            }

            double xPos = Bowser.Location.X;
            double yPos = Bowser.Location.Y;

            xPos += XVelocity;
            yPos += YVelocity;
            Vector2 pos = ClampPosition(xPos, yPos);

            Bowser.Location             = pos;
            Bowser.DestinationRectangle = new Rectangle((int)pos.X, (int)pos.Y, Bowser.DestinationRectangle.Width,
                                                        Bowser.DestinationRectangle.Height);
            YVelocity += GravityCoef;
        }