23-08-2006, 11:54 AM
(cause I love MS so much, I decided to release it.. hope somebody likes it.)
This tutorial can not be moved to any other forums, neither linked or anything. You can only come here to use it.
I will not explain anything were to put the things, it's pretty simple. So figure it out on your own.
This tutorial can not be moved to any other forums, neither linked or anything. You can only come here to use it.
I will not explain anything were to put the things, it's pretty simple. So figure it out on your own.
Code:
If Button = vbRightButton Then
If Not InEditor Then
Call CharMove(X, Y)
End If
End If
Code:
Public Sub CharMove(ByVal X As Single, ByVal Y As Single)
'Finds the heading way with our mouse position
Dim iScrX As Integer
Dim iScrY As Integer
Dim lAngle As Long
iScrX = X - frmMirage.picScreen.Left - Player(MyIndex).X * 32
iScrY = Y - frmMirage.picScreen.top - Player(MyIndex).Y * 32
iScrY = -iScrY
If iScrY = 0 Then
lAngle = 0
Else
lAngle = Atn(iScrX / iScrY) * 180 / 3.14159265
End If
If (lAngle >= -45 And lAngle 0 Then
DirUp = True
DirDown = False
DirLeft = False
DirRight = False
If CanMove = True Then
Call SetPlayerDir(MyIndex, DIR_UP)
Call CheckMovement
End If
Else
DirUp = False
DirDown = True
DirLeft = False
DirRight = False
If CanMove = True Then
Call SetPlayerDir(MyIndex, DIR_DOWN)
Call CheckMovement
End If
End If
ElseIf (lAngle > 45 And lAngle = -90) Then
If iScrX < 0 Then
DirUp = False
DirDown = False
DirLeft = True
DirRight = False
If CanMove = True Then
Call SetPlayerDir(MyIndex, DIR_LEFT)
Call CheckMovement
End If
Else
DirUp = False
DirDown = False
DirLeft = False
DirRight = True
If CanMove = True Then
Call SetPlayerDir(MyIndex, DIR_RIGHT)
Call CheckMovement
End If
End If
End If
End Sub