コード例 #1
0
        private void updMovement(object sender, EventArgs e)
        {
            switch (player.currAnimation)
            {
            case 0:
                //currAnimation = 0;
                player.Right();
                if (player._x > this.Width / 2 && player._x < sideOfMapObject * height - this.Width / 2)
                {
                    delta.X -= player.speed;
                }
                break;

            case 1:
                //currAnimation = 1;
                player.Left();
                if (player._x > this.Width / 2 && player._x < sideOfMapObject * height - this.Width / 2)
                {
                    delta.X += player.speed;
                }
                break;

            case 3:
                //currAnimation = 3;
                player.Up();
                if (player._y > this.Height / 2 && player._y < sideOfMapObject * width - this.Height / 2)
                {
                    delta.Y += player.speed;
                }
                break;

            case 2:
                //currAnimation = 2;
                player.Down();
                if (player._y > this.Height / 2 && player._y < sideOfMapObject * width - this.Height / 2)
                {
                    delta.Y -= player.speed;
                }
                break;
            }
            this.Invalidate();
        }