Ejemplo n.º 1
0
        public virtual void Draw(RenderWindow rw)
        {
            SFML.Graphics.Sprite s = new SFML.Graphics.Sprite(Program.Data.SpriteBasedOnType(SpriteType.Sprite)[_sprite]);
            int width = (int)s.Texture.Size.X / 3;
            int height = (int)s.Texture.Size.Y / 4;
            if (_isWalking)
            {
                switch (_dir)
                {
                    case 0:
                        if (_speed < 48)
                        {
                            if (_walkCount < 48)
                                s.TextureRect = new IntRect(0, (int)s.Texture.Size.Y / 4 * 2, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            else if (_walkCount >= 48 && _walkCount < 88)
                                s.TextureRect = new IntRect((int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4 * 2, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            else if (_walkCount >= 88 && _walkCount < 128)
                                s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, (int)s.Texture.Size.Y / 4 * 2, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                        }
                        else if (_speed >= 48 && _speed < 128)
                        {
                            if (_walkCount < 128)
                                s.TextureRect = new IntRect(0, (int)s.Texture.Size.Y / 4 * 2, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            else
                                s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, (int)s.Texture.Size.Y / 4 * 2, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                        }
                        else if (_speed >= 128)
                        {
                            if (_walkCount >= 128)
                            {
                                if (_lefted)
                                    s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, (int)s.Texture.Size.Y / 4 * 2, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                                else
                                    s.TextureRect = new IntRect(0, (int)s.Texture.Size.Y / 4 * 2, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            }
                        }
                        break;
                    case 1:
                        if (_speed < 48)
                        {
                            if (_walkCount < 48)
                                s.TextureRect = new IntRect(0, (int)s.Texture.Size.Y / 4 * 3, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            else if (_walkCount >= 48 && _walkCount < 88)
                                s.TextureRect = new IntRect((int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4 * 3, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            else if (_walkCount >= 88 && _walkCount < 128)
                                s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, (int)s.Texture.Size.Y / 4 * 3, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                        }
                        else if (_speed >= 48 && _speed < 128)
                        {
                            if (_walkCount < 128)
                                s.TextureRect = new IntRect(0, (int)s.Texture.Size.Y / 4 * 3, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            else
                                s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, (int)s.Texture.Size.Y / 4 * 3, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                        }
                        else if (_speed >= 128)
                        {
                            if (_walkCount >= 128)
                            {
                                if (_lefted)
                                    s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, (int)s.Texture.Size.Y / 4 * 3, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                                else
                                    s.TextureRect = new IntRect(0, (int)s.Texture.Size.Y / 4 * 3, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            }
                        }
                        break;
                    case 2:
                        if (_speed < 48)
                        {
                            if (_walkCount < 48)
                                s.TextureRect = new IntRect(0, (int)s.Texture.Size.Y / 4 , (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            else if (_walkCount >= 48 && _walkCount < 88)
                                s.TextureRect = new IntRect((int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4 , (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            else if (_walkCount >= 88 && _walkCount < 128)
                                s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, (int)s.Texture.Size.Y / 4 , (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                        }
                        else if (_speed >= 48 && _speed < 128)
                        {
                            if (_walkCount < 128)
                                s.TextureRect = new IntRect(0, (int)s.Texture.Size.Y / 4 , (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            else
                                s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, (int)s.Texture.Size.Y / 4 , (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                        }
                        else if (_speed >= 128)
                        {
                            if (_walkCount >= 128)
                            {
                                if (_lefted)
                                    s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, (int)s.Texture.Size.Y / 4 , (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                                else
                                    s.TextureRect = new IntRect(0, (int)s.Texture.Size.Y / 4 , (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            }
                        }
                        break;
                    case 3:
                        if (_speed < 48)
                        {
                            if (_walkCount < 48)
                                s.TextureRect = new IntRect(0, 0, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            else if (_walkCount >= 48 && _walkCount < 88)
                                s.TextureRect = new IntRect((int)s.Texture.Size.X / 3, 0, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            else if (_walkCount >= 88 && _walkCount < 128)
                                s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, 0, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                        }
                        else if (_speed >= 48 && _speed < 128)
                        {
                            if (_walkCount < 128)
                                s.TextureRect = new IntRect(0, 0, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            else
                                s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, 0, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                        }
                        else if (_speed >= 128)
                        {
                            if (_walkCount >= 128)
                            {
                                if (_lefted)
                                    s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, 0, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                                else
                                    s.TextureRect = new IntRect(0, 0, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            }
                        }
                        break;
                }
            }
            else
            {
                switch (_dir)
                {
                    case 0:
                        s.TextureRect = new IntRect((int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4 * 2, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                        break;
                    case 1:
                        s.TextureRect = new IntRect((int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4 * 3, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                        break;
                    case 2:
                        s.TextureRect = new IntRect((int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                        break;
                    case 3:
                        s.TextureRect = new IntRect((int)s.Texture.Size.X / 3, 0, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                        break;
                }
            }
            int tempoffsetX = 0;
            int tempoffsetY = 0;
            switch (_targetDir)
            {
                case 0:
                    tempoffsetX = -_walkCount;
                    break;
                case 1:
                    tempoffsetY = -_walkCount;
                    break;
                case 2:
                    tempoffsetX = _walkCount;
                    break;
                case 3:
                    tempoffsetY = _walkCount;
                    break;
            }

            s.Position = new Vector2f((LastX + CurMap.MinX) * 16 + tempoffsetX / 8, (LastY + CurMap.MinY) * 16 - 10 + tempoffsetY / 8);
            rw.Draw(s);

            //Draw minihud

            s = new SFML.Graphics.Sprite(Program.Data.SpriteBasedOnType(SpriteType.SmallHUD)[0]);
            s.TextureRect = new IntRect(0, 0, 1, 1);
            for (int i = 1; i < 3; i++)
            {
                s.Position = new Vector2f((LastX + CurMap.MinX) * 16 + tempoffsetX / 8, (LastY + CurMap.MinY) * 16 - 10 + tempoffsetY / 8 - height / 2 + 8 + i);
                rw.Draw(s);
                s.Position = new Vector2f((LastX + CurMap.MinX) * 16 + tempoffsetX / 8 + width, (LastY + CurMap.MinY) * 16 - 10 + tempoffsetY / 8 - height / 2 + 8 + i);
                rw.Draw(s);
            }
            for (int i = 0; i < width + 1; i++)
            {
                s.Position = new Vector2f((LastX + CurMap.MinX) * 16 + tempoffsetX / 8 + i, (LastY + CurMap.MinY) * 16 - 10 + tempoffsetY / 8 - height / 2 + 8);
                rw.Draw(s);
                s.Position = new Vector2f((LastX + CurMap.MinX) * 16 + tempoffsetX / 8 + i, (LastY + CurMap.MinY) * 16 - 10 + tempoffsetY / 8 - height / 2 + 10);
                rw.Draw(s);
            }
            //find health percentage
            int percentage = _curHP * 100 / MaxHealth;
            for (int i = 1; i < width; i++)
            {
                if (i * 100 / (width - 1) > percentage)
                    s.TextureRect = new IntRect(2, 0, 1, 1);
                else
                    s.TextureRect = new IntRect(1, 0, 1, 1);
                s.Position = new Vector2f((LastX + CurMap.MinX) * 16 + tempoffsetX / 8 + i - 8, (LastY + CurMap.MinY) * 16 - 10 + tempoffsetY / 8 - height / 2 - 8);
                rw.Draw(s);
            }
        }
 public virtual void Draw(RenderWindow rw)
 {
     SFML.Graphics.Sprite s = new SFML.Graphics.Sprite(Program.Data.SpriteBasedOnType(SpriteType.Sprite)[_sprite]);
     if (_isWalking)
     {
         switch (_targetDir)
         {
             case 0:
                 if (_speed < 6)
                 {
                     if (_walkCount < 6)
                         s.TextureRect = new IntRect(0, (int)s.Texture.Size.Y / 4 * 2, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                     else if (_walkCount >= 6 && _walkCount < 11)
                         s.TextureRect = new IntRect((int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4 * 2, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                     else if (_walkCount >= 11 && _walkCount < 16)
                         s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, (int)s.Texture.Size.Y / 4 * 2, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                 }
                 else if (_speed >= 6 && _speed < 8)
                 {
                     if (_walkCount < 8)
                         s.TextureRect = new IntRect(0, (int)s.Texture.Size.Y / 4 * 2, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                     else
                         s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, (int)s.Texture.Size.Y / 4 * 2, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                 }
                 else if (_speed >= 8)
                 {
                     if (_walkCount >= 8)
                     {
                         if (_lefted)
                             s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, (int)s.Texture.Size.Y / 4 * 2, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                         else
                             s.TextureRect = new IntRect(0, (int)s.Texture.Size.Y / 4 * 2, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                     }
                 }
                 break;
             case 1:
                 if (_speed < 6)
                 {
                     if (_walkCount < 6)
                         s.TextureRect = new IntRect(0, (int)s.Texture.Size.Y / 4 * 3, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                     else if (_walkCount >= 6 && _walkCount < 11)
                         s.TextureRect = new IntRect((int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4 * 3, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                     else if (_walkCount >= 11 && _walkCount < 16)
                         s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, (int)s.Texture.Size.Y / 4 * 3, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                 }
                 else if (_speed >= 6 && _speed < 8)
                 {
                     if (_walkCount < 8)
                         s.TextureRect = new IntRect(0, (int)s.Texture.Size.Y / 4 * 3, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                     else
                         s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, (int)s.Texture.Size.Y / 4 * 3, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                 }
                 else if (_speed >= 8)
                 {
                     if (_walkCount >= 8)
                     {
                         if (_lefted)
                             s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, (int)s.Texture.Size.Y / 4 * 3, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                         else
                             s.TextureRect = new IntRect(0, (int)s.Texture.Size.Y / 4 * 3, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                     }
                 }
                 break;
             case 2:
                 if (_speed < 6)
                 {
                     if (_walkCount < 6)
                         s.TextureRect = new IntRect(0, (int)s.Texture.Size.Y / 4 , (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                     else if (_walkCount >= 6 && _walkCount < 11)
                         s.TextureRect = new IntRect((int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4 , (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                     else if (_walkCount >= 11 && _walkCount < 16)
                         s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, (int)s.Texture.Size.Y / 4 , (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                 }
                 else if (_speed >= 6 && _speed < 8)
                 {
                     if (_walkCount < 8)
                         s.TextureRect = new IntRect(0, (int)s.Texture.Size.Y / 4 , (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                     else
                         s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, (int)s.Texture.Size.Y / 4 , (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                 }
                 else if (_speed >= 8)
                 {
                     if (_walkCount >= 8)
                     {
                         if (_lefted)
                             s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, (int)s.Texture.Size.Y / 4 , (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                         else
                             s.TextureRect = new IntRect(0, (int)s.Texture.Size.Y / 4 , (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                     }
                 }
                 break;
             case 3:
                 if (_speed < 6)
                 {
                     if (_walkCount < 6)
                         s.TextureRect = new IntRect(0, 0, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                     else if (_walkCount >= 6 && _walkCount < 11)
                         s.TextureRect = new IntRect((int)s.Texture.Size.X / 3, 0, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                     else if (_walkCount >= 11 && _walkCount < 16)
                         s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, 0, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                 }
                 else if (_speed >= 6 && _speed < 8)
                 {
                     if (_walkCount < 8)
                         s.TextureRect = new IntRect(0, 0, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                     else
                         s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, 0, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                 }
                 else if (_speed >= 8)
                 {
                     if (_walkCount >= 8)
                     {
                         if (_lefted)
                             s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, 0, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                         else
                             s.TextureRect = new IntRect(0, 0, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                     }
                 }
                 break;
         }
     }
     else
     {
         switch (_dir)
         {
             case 0:
                 s.TextureRect = new IntRect((int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4 * 2, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                 break;
             case 1:
                 s.TextureRect = new IntRect((int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4 * 3, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                 break;
             case 2:
                 s.TextureRect = new IntRect((int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                 break;
             case 3:
                 s.TextureRect = new IntRect((int)s.Texture.Size.X / 3, 0, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                 break;
         }
     }
     int tempoffsetX = 0;
     int tempoffsetY = 0;
     switch (_dir)
     {
         case 0:
             tempoffsetX = -_walkCount;
             break;
         case 1:
             tempoffsetY = -_walkCount;
             break;
         case 2:
             tempoffsetX = _walkCount;
             break;
         case 3:
             tempoffsetY = _walkCount;
             break;
     }
     s.Position = new Vector2f((_x + Program.MyMap.MinX) * 16 + tempoffsetX, (_y + Program.MyMap.MinY) * 16 - 10 + tempoffsetY);
     rw.Draw(s);
 }
Ejemplo n.º 3
0
        public virtual void Draw(RenderWindow rw, int x, int y)
        {
            SFML.Graphics.Sprite s = new SFML.Graphics.Sprite(Program.Data.SpriteBasedOnType(SpriteType.Sprite)[_sprite]);
            int width = (int)s.Texture.Size.X / 3;
            int height = (int)s.Texture.Size.Y / 4;
            if (_isWalking)
            {
                switch (_dir)
                {
                    case 0:
                        if (_speed < 48)
                        {
                            if (_walkCount < 48)
                                s.TextureRect = new IntRect(0, (int)s.Texture.Size.Y / 4 * 2, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            else if (_walkCount >= 48 && _walkCount < 88)
                                s.TextureRect = new IntRect((int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4 * 2, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            else if (_walkCount >= 88 && _walkCount < 128)
                                s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, (int)s.Texture.Size.Y / 4 * 2, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                        }
                        else if (_speed >= 48 && _speed < 128)
                        {
                            if (_walkCount < 128)
                                s.TextureRect = new IntRect(0, (int)s.Texture.Size.Y / 4 * 2, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            else
                                s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, (int)s.Texture.Size.Y / 4 * 2, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                        }
                        else if (_speed >= 128)
                        {
                            if (_walkCount >= 128)
                            {
                                if (_lefted)
                                    s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, (int)s.Texture.Size.Y / 4 * 2, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                                else
                                    s.TextureRect = new IntRect(0, (int)s.Texture.Size.Y / 4 * 2, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            }
                        }
                        break;
                    case 1:
                        if (_speed < 48)
                        {
                            if (_walkCount < 48)
                                s.TextureRect = new IntRect(0, (int)s.Texture.Size.Y / 4 * 3, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            else if (_walkCount >= 48 && _walkCount < 88)
                                s.TextureRect = new IntRect((int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4 * 3, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            else if (_walkCount >= 88 && _walkCount < 128)
                                s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, (int)s.Texture.Size.Y / 4 * 3, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                        }
                        else if (_speed >= 48 && _speed < 128)
                        {
                            if (_walkCount < 128)
                                s.TextureRect = new IntRect(0, (int)s.Texture.Size.Y / 4 * 3, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            else
                                s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, (int)s.Texture.Size.Y / 4 * 3, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                        }
                        else if (_speed >= 128)
                        {
                            if (_walkCount >= 128)
                            {
                                if (_lefted)
                                    s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, (int)s.Texture.Size.Y / 4 * 3, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                                else
                                    s.TextureRect = new IntRect(0, (int)s.Texture.Size.Y / 4 * 3, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            }
                        }
                        break;
                    case 2:
                        if (_speed < 48)
                        {
                            if (_walkCount < 48)
                                s.TextureRect = new IntRect(0, (int)s.Texture.Size.Y / 4, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            else if (_walkCount >= 48 && _walkCount < 88)
                                s.TextureRect = new IntRect((int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            else if (_walkCount >= 88 && _walkCount < 128)
                                s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, (int)s.Texture.Size.Y / 4, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                        }
                        else if (_speed >= 48 && _speed < 128)
                        {
                            if (_walkCount < 128)
                                s.TextureRect = new IntRect(0, (int)s.Texture.Size.Y / 4, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            else
                                s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, (int)s.Texture.Size.Y / 4, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                        }
                        else if (_speed >= 128)
                        {
                            if (_walkCount >= 128)
                            {
                                if (_lefted)
                                    s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, (int)s.Texture.Size.Y / 4, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                                else
                                    s.TextureRect = new IntRect(0, (int)s.Texture.Size.Y / 4, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            }
                        }
                        break;
                    case 3:
                        if (_speed < 48)
                        {
                            if (_walkCount < 48)
                                s.TextureRect = new IntRect(0, 0, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            else if (_walkCount >= 48 && _walkCount < 88)
                                s.TextureRect = new IntRect((int)s.Texture.Size.X / 3, 0, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            else if (_walkCount >= 88 && _walkCount < 128)
                                s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, 0, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                        }
                        else if (_speed >= 48 && _speed < 128)
                        {
                            if (_walkCount < 128)
                                s.TextureRect = new IntRect(0, 0, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            else
                                s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, 0, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                        }
                        else if (_speed >= 128)
                        {
                            if (_walkCount >= 128)
                            {
                                if (_lefted)
                                    s.TextureRect = new IntRect((int)s.Texture.Size.X / 3 * 2, 0, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                                else
                                    s.TextureRect = new IntRect(0, 0, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                            }
                        }
                        break;
                }
            }
            else
            {
                switch (_dir)
                {
                    case 0:
                        s.TextureRect = new IntRect((int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4 * 2, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                        break;
                    case 1:
                        s.TextureRect = new IntRect((int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4 * 3, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                        break;
                    case 2:
                        s.TextureRect = new IntRect((int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                        break;
                    case 3:
                        s.TextureRect = new IntRect((int)s.Texture.Size.X / 3, 0, (int)s.Texture.Size.X / 3, (int)s.Texture.Size.Y / 4);
                        break;
                }
            }
            int tempoffsetX = 0;
            int tempoffsetY = 0;
            switch (_targetDir)
            {
                case 0:
                    tempoffsetX = -_walkCount;
                    break;
                case 1:
                    tempoffsetY = -_walkCount;
                    break;
                case 2:
                    tempoffsetX = _walkCount;
                    break;
                case 3:
                    tempoffsetY = _walkCount;
                    break;
            }

            s.Position = new Vector2f(x, y);
            rw.Draw(s);
        }