예제 #1
0
        public override void Update()
        {
            if (punching)
            {
                currentPunch = new Punch(pos.X + (int)(facing * 30), pos.Y);
                punching     = false;
            }
            if (moveLeft)
            {
                pos.X      -= 1;
                currentAnim = walkingLAnim;
                facing      = -1;
            }
            if (moveRight)
            {
                pos.X      += 1;
                currentAnim = walkingRAnim;
                facing      = 1;
            }

            if (moveLeft || moveRight)
            {
                boundingBox.setPosition(pos);
            }

            if (!moveLeft && !moveRight)
            {
                if (facing == -1)
                {
                    currentAnim = standingLAnim;
                }
                if (facing == 1)
                {
                    currentAnim = standingRAnim;
                }
            }
            foreach (Timer t in timers)
            {
                t.Update();
            }
            if (punchLength.timeIsUp())
            {
                currentPunch = null;
            }

            currentAnim.Update();
        }
예제 #2
0
        public override void Update()
        {
            if (punching)
            {
                currentPunch = new Punch(pos.X + (int) (facing * 30), pos.Y);
                punching = false;
            }
            if (moveLeft)
            {
                pos.X -= 1;
                currentAnim = walkingLAnim;
                facing = -1;
            }
            if (moveRight)
            {
                pos.X += 1;
                currentAnim = walkingRAnim;
                facing = 1;
            }

            if (moveLeft || moveRight)
            {
                boundingBox.setPosition(pos);
            }

            if (!moveLeft && !moveRight)
            {
                if (facing == -1)
                {
                    currentAnim = standingLAnim;
                }
                if (facing == 1)
                {
                    currentAnim = standingRAnim;
                }
            }
            foreach (Timer t in timers)
            {
                t.Update();
            }
            if (punchLength.timeIsUp())
            {
                currentPunch = null;
            }

            currentAnim.Update();
        }