⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 draw actor, players.vb.svn-base

📁 MirUnleashed vb.net Module modMainServer Public WithEvents Socket As New WinsockServer Pub
💻 SVN-BASE
📖 第 1 页 / 共 3 页
字号:
            End If

            Actor.Animation = 0
            Actor.Stance = 1
            Actor.StanceTick = DateTime.Now.Ticks
        End If

    End Sub

    Public Sub ActorDie()

        Actor.Animation = Actor.Animation + 1

        If Actor.Animation >= 4 Then

            Actor.ActionState = 0
            Actor.Animation = 0

        End If

    End Sub

    Public Sub ActorStun()

        Actor.Animation = Actor.Animation + 1

        If Actor.Animation >= 3 Then

            'tempstun = tempstun + 1
            Actor.MoveTick = DateTime.Now.Ticks '- (140 * 0.33)
            Actor.AttackTick = DateTime.Now.Ticks '- (100 * 0.33)

            If Actor.MoveTick > DateTime.Now.Ticks Then
                Beep()
            End If

            If Actor.StackActionType(0) = PlayerActionType.Stun Then
                ActorUseStack()
            Else
                Actor.ActionState = 0
                Actor.Animation = 0
                Exit Sub
            End If

            Actor.Animation = 0

        End If

    End Sub

    Public Sub ActorCast()

        Actor.Animation = Actor.Animation + 1

        If Actor.Animation >= 8 Then

            If Actor.StackActionType(0) = PlayerActionType.Cast Then
                ActorUseStack()
            Else
                Actor.ActionState = 0
                Actor.Animation = 0
                Actor.Stance = 1
                Actor.StanceTick = DateTime.Now.Ticks
            End If


        End If

    End Sub

    Public Sub ActorMove()

        If Actor.Animation > 3 And Actor.StackMoveTick + (Actor.MoveSpeed * 10000) < DateTime.Now.Ticks Then 'And Not Actor.StackActionType(0) = PlayerActionType.Stun
            If IsMouseDown = True Then
                Actor.StackMoveTick = DateTime.Now.Ticks

                'send move
                InputDirection()

                If MouseEvents.Button = MouseButtons.Left And ShiftDown = False And Not (HighlightType = 1 And HighlightOn = True) And DragOn = False Then
                    If CollisionDetect(1, TempPlayerDirection) = False Then
                        Packets.SendMove(TempPlayerDirection, 1, InfrontX(1, TempPlayerDirection), InfrontY(1, TempPlayerDirection))
                    End If
                ElseIf MouseEvents.Button = MouseButtons.Right And ShiftDown = False And Not (HighlightType = 1 And HighlightOn = True) And DragOn = False Then
                    '2 steps, if 2 step fails try 1 step
                    If CollisionDetect(2, TempPlayerDirection) = False Then
                        Packets.SendMove(TempPlayerDirection, 2, InfrontX(2, TempPlayerDirection), InfrontY(2, TempPlayerDirection))
                    ElseIf CollisionDetect(1, TempPlayerDirection) = False Then
                        Packets.SendMove(TempPlayerDirection, 1, InfrontX(1, TempPlayerDirection), InfrontY(1, TempPlayerDirection))
                    End If
                End If
            End If
        End If

        If Actor.Animation >= 5 Then
            Actor.CurrentX = Actor.X
            Actor.CurrentY = Actor.Y
            Actor.Animation = 0

            'check stack for any items
            If Not Actor.StackItems = 0 Then

                Dim I As Integer

                'take out first item of stack and use it
                If Actor.StackActionType(0) = PlayerActionType.Move Then
                    ActorUseStack()
                Else
                    Actor.ActionState = 0
                    Actor.Animation = 0
                    Exit Sub
                End If

                're-organise stack so we can quickly use it next time
                'If Not Actor.StackItems = 0 Then
                ' For I = 0 To 4
                ' Actor.StackCordX(I) = Actor.StackCordX(I + 1)
                ' Actor.StackCordY(I) = Actor.StackCordY(I + 1)
                ' Actor.StackDirection(I) = Actor.StackDirection(I + 1)
                ' Actor.StackMoveType(I) = Actor.StackMoveType(I + 1)
                ' Actor.StackExist(I) = Actor.StackExist(I + 1)
                ' Actor.StackActionType(I) = Actor.StackActionType(I + 1)
                ' Next I
                'End If
            Else
                Actor.ActionState = 0
                Exit Sub
            End If

        End If

        If Actor.ActionState = 1 Then
            If Actor.Direction = 0 Then
                Actor.CurrentY = Actor.CurrentY - ActorMoveAmount()
                'Actor.CordY = SymArith(Actor.CordY, 2)
                Actor.Animation = Actor.Animation + 1
                'Call ActorMoveSound()
            ElseIf Actor.Direction = 1 Then
                Actor.Animation = Actor.Animation + 1
                Actor.CurrentY = Actor.CurrentY - ActorMoveAmount()
                'Actor.CordY = SymArith(Actor.CordY, 2)
                Actor.CurrentX = Actor.CurrentX + ActorMoveAmount()
                'Actor.CordX = SymArith(Actor.CordX, 2)
                'Call ActorMoveSound()
            ElseIf Actor.Direction = 2 Then
                Actor.CurrentX = Actor.CurrentX + ActorMoveAmount()
                'Actor.CordX = SymArith(Actor.CordX, 2)
                Actor.Animation = Actor.Animation + 1
                'Call ActorMoveSound()
            ElseIf Actor.Direction = 3 Then
                Actor.Animation = Actor.Animation + 1
                Actor.CurrentX = Actor.CurrentX + ActorMoveAmount()
                'Actor.CordX = SymArith(Actor.CordX, 2)
                Actor.CurrentY = Actor.CurrentY + ActorMoveAmount()
                'Actor.CordY = SymArith(Actor.CordY, 2)
                'Call ActorMoveSound()
            ElseIf Actor.Direction = 4 Then
                Actor.Animation = Actor.Animation + 1
                Actor.CurrentY = Actor.CurrentY + ActorMoveAmount()
                'Actor.CordY = SymArith(Actor.CordY, 2)
                'Call ActorMoveSound()
            ElseIf Actor.Direction = 5 Then
                Actor.Animation = Actor.Animation + 1
                Actor.CurrentX = Actor.CurrentX - ActorMoveAmount()
                'Actor.CordX = SymArith(Actor.CordX, 2)
                Actor.CurrentY = Actor.CurrentY + ActorMoveAmount()
                'Actor.CordY = SymArith(Actor.CordY, 2)
                'Call ActorMoveSound()
            ElseIf Actor.Direction = 6 Then
                Actor.Animation = Actor.Animation + 1
                Actor.CurrentX = Actor.CurrentX - ActorMoveAmount()
                'Actor.CordX = SymArith(Actor.CordX, 2)
                'Call ActorMoveSound()
            ElseIf Actor.Direction = 7 Then
                Actor.Animation = Actor.Animation + 1
                Actor.CurrentX = Actor.CurrentX - ActorMoveAmount()
                'Actor.CordX = SymArith(Actor.CordX, 2)
                Actor.CurrentY = Actor.CurrentY - ActorMoveAmount()
                'Actor.CordY = SymArith(Actor.CordY, 2)
                'Call ActorMoveSound()
            End If
        End If

    End Sub

    Function ActorMoveAmount()

        Dim Quantity As Double = 1 / 5

        If Actor.Animation = 0 Then
            ActorMoveAmount = Quantity * Actor.MoveType
        ElseIf Actor.Animation = 1 Then
            ActorMoveAmount = Quantity * Actor.MoveType
        ElseIf Actor.Animation = 2 Then
            ActorMoveAmount = Quantity * Actor.MoveType
        ElseIf Actor.Animation = 3 Then
            ActorMoveAmount = Quantity * Actor.MoveType
        ElseIf Actor.Animation = 4 Then
            ActorMoveAmount = Quantity * Actor.MoveType
        ElseIf Actor.Animation = 5 Then
            ActorMoveAmount = Quantity * Actor.MoveType
        ElseIf Actor.Animation = 6 Then
            'ActorMoveAmount = Quantity * Actor.MoveType
        End If

        'temp here to update text cords

        'CheckMouseOverPlayer(CursorX, CursorY)

    End Function
#End Region

#Region "Draw All Player Movements/Looks and Effects - Draw other players basically!"

    Public Sub DrawPlayer(ByVal Index As Integer, ByVal BaseX As Single, ByVal BaseY As Single)
        Dim TempX As Integer
        Dim TempY As Integer
        Dim TempInt As Integer

        BaseX = Actor.CurrentX
        BaseY = Actor.CurrentY

        'find this so that we can use the height and width for text overhead

        TempInt = (PlayerLook(Index) * 600)

        If WIL_HumImage.ImageLoaded(TempInt) = False Then
            WIL_HumImage.ImageLoaded(TempInt) = True
            LoadWILHumImage(TempInt)
        End If

        Player(Index).MainHeight = WIL_HumImage.ImageHeight(TempInt)
        Player(Index).MainWidth = WIL_HumImage.ImageWidth(TempInt)

        If Player(Index).ActionState = 4 Then
            Player(Index).ActionLook = 536
        ElseIf Player(Index).ActionState = 0 And Player(Index).Stance = 1 Then
            Player(Index).ActionLook = 192
        ElseIf Player(Index).ActionState = 1 And Player(Index).MoveType = 1 Then
            Player(Index).ActionLook = 64
        ElseIf Player(Index).ActionState = 1 And Player(Index).MoveType = 2 Then
            Player(Index).ActionLook = 128
        ElseIf Player(Index).ActionState = 2 Then
            Player(Index).ActionLook = 200
        ElseIf Player(Index).ActionState = 3 Then
            Player(Index).ActionLook = 472
        ElseIf Player(Index).ActionState = 7 Then
            Player(Index).ActionLook = 392
        Else
            Player(Index).ActionLook = 0
        End If

        If Player(Index).ActionState = 0 And Player(Index).IsDead = True Then
            TempInt = (PlayerLook(Index) * 600) + (Player(Index).Dir * 8) + 536 + 3
        ElseIf Not Player(Index).Stance = 0 And Player(Index).ActionState = 0 And Not Player(Index).ActionState = 3 Then
            TempInt = (PlayerLook(Index) * 600) + Player(Index).Animation + (Player(Index).Dir) + Player(Index).ActionLook
        ElseIf Not Player(Index).ActionState = 3 Then
            TempInt = (PlayerLook(Index) * 600) + Player(Index).Animation + (Player(Index).Dir * 8) + Player(Index).ActionLook
        ElseIf Player(Index).ActionState = 3 Then
            TempInt = (PlayerLook(Index) * 600) + Player(Index).Animation + (Player(Index).Dir * 8) + Player(Index).ActionLook
        ElseIf Player(Index).ActionState = 4 And Player(Index).IsDead = True Then
            TempInt = (PlayerLook(Index) * 600) + Player(Index).Animation + (Player(Index).Dir * 4) + Player(Index).ActionLook
        End If

        If WIL_HumImage.ImageLoaded(TempInt) = False Then
            WIL_HumImage.ImageLoaded(TempInt) = True
            LoadWILHumImage(TempInt)
        End If

        '(ScreenWidth / 2) + (48 * ((PlayerCordX(Sprites(I).Index)) - (PlayerCordX(0)))) - 30 + UnitPlacementX(Sprites(I).Race, Sprites(I).Look, Sprites(I).Image)
        'Sprites(I).Y = (ScreenHeight / 2) + (32 * ((PlayerCordY(Sprites(I).Index)) - (PlayerCordY(0)))) - 75 + UnitPlacementY(Sprites(I).Race, Sprites(I).Look, Sprites(I).Image)
        TempX = (GameWidth / 2) + (48 * (Player(Index).CurrentX - BaseX)) - 30 + WIL_HumImage.ImageX(TempInt)
        TempY = (GameHeight / 2) + (32 * (Player(Index).CurrentY - BaseY)) - 75 + WIL_HumImage.ImageY(TempInt) - 10

        Player(Index).MainTop = TempY
        Player(Index).MainLeft = TempX
        Player(Index).MainPlaceX = WIL_HumImage.ImageX(TempInt)
        Player(Index).MainPlaceY = WIL_HumImage.ImageY(TempInt)
        Player(Index).CurrentHeight = WIL_HumImage.ImageHeight(TempInt)
        Player(Index).CurrentWidth = WIL_HumImage.ImageWidth(TempInt)

        GameSprite.Begin(SpriteFlags.DoNotSaveState)
        SetBlend(1)

        If Player(Index).Dir = 0 Or Player(Index).Dir = 4 Or Player(Index).Dir = 5 Or Player(Index).Dir = 6 Or Player(Index).Dir = 7 Then
            DrawPlayerWeapon(TempInt, Index, BaseX, BaseY)
        End If

        If WIL_HumImage.ImageLoaded(TempInt) = True Then
            Dim I As Integer

            If Actor.MapLight = 0 Then
                GameSprite.Draw(WIL_HumImage.ImageTexture(TempInt), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(TempX, TempY, 0), Color.SkyBlue)
            ElseIf Actor.MapLight = 2 Then
                GameSprite.Draw(WIL_HumImage.ImageTexture(TempInt), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(TempX, TempY, 0), Color.FromArgb(255, 225, 150, 80))
            Else
                GameSprite.Draw(WIL_HumImage.ImageTexture(TempInt), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(TempX, TempY, 0), Color.White)
            End If
        End If

        If Player(Index).Dir = 3 Or Player(Index).Dir = 2 Or Player(Index).Dir = 1 Then
            DrawPlayerWeapon(TempInt, Index, BaseX, BaseY)
        End If

        If Actor.MapLight = 0 Then
            GameSprite.Draw(WIL_HumImage.ImageTexture(TempInt), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(TempX, TempY, 0), Color.SkyBlue)
        ElseIf Actor.MapLight = 2 Then
            GameSprite.Draw(WIL_HumImage.ImageTexture(TempInt), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(TempX, TempY, 0), Color.FromArgb(255, 225, 150, 80))
        Else
            GameSprite.Draw(WIL_HumImage.ImageTexture(TempInt), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(TempX, TempY, 0), Color.White)
        End If


        If CheckMouseOverPlayer(CursorX, CursorY, Player(Index).Name) = True Then
            Dim S As Short

            For S = 0 To 10
                TextOverlayText(S) = ""
            Next S

            TextOverlayText(0) = "You have " & Player(Index).Name & " selected."
            TextOverlayText(1) = "Their X: " & Player(Index).CurrentX & "  Their Y: " & Player(Index).CurrentY

            If Not Player(Index).Guild = "" Then
                TextOverlayText(2) = "Guild Member of: " & Player(Index).Guild
            Else
                TextOverlayText(2) = "They do not reside in a guild."
            End If

            TextOverlayText(3) = ""

            PlayerTempName = Index
            TextOverlay = True

        End If

        GameSprite.End()

        'DrawPlayerHumEffect(Index, TempInt, BaseX, BaseY)

    End Sub

    Public Sub DrawPlayerWeapon(ByVal Look As Integer, ByVal Index As Integer, ByVal BaseX As Single, ByVal BaseY As Single)
        Dim TempX As Integer
        Dim TempY As Integer
        Dim TempInt As Integer

        If Player(Index).EquipItem(12).Exist = True Then

            TempInt = (1200 * Player(Index).EquipItem(12).Shape) + (Look - (PlayerLook(Index) * 600))


            If WIL_WeaponImage.ImageLoaded(TempInt) = False Then
                WIL_WeaponImage.ImageLoaded(TempInt) = True
                LoadWILWeaponImage(TempInt)
            End If

            TempX = (GameWidth / 2) + (48 * (Player(Index).CurrentX - BaseX)) - 30 + WIL_WeaponImage.ImageX(TempInt)
            TempY = (GameHeight / 2) + (32 * (Player(Index).CurrentY - BaseY)) - 82 + WIL_WeaponImage.ImageY(TempInt)

            GameSprite.Draw(WIL_WeaponImage.ImageTexture(TempInt), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(TempX, TempY, 0), Color.White)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -