Movimento por Mouse
:: Eclipse Origins :: Tutoriais
Página 1 de 1
Movimento por Mouse
Para quem nao tem a engine em Directx8,aí segue o download da mesma: [Apenas Administradores podem visualizar links]
Bom,este tutorial trata-se de um tutorial exclusivo à comunidade,o autor pede que o mesmo nao seja copiado
Ao fim de " ModGlobal "
Adicine:
Adicine:
Procure por:
Mude sua Sub inteira por:
Na sua " frmmain " na sub " MouseDown " ( Observaçao: Pode ser na Sub " Mousedown " ou na frmmain_Mousedown,mas tanto faz. )
Fim,se bugar podem comentar no tópico que eu arrumo ; )
Bom,este tutorial trata-se de um tutorial exclusivo à comunidade,o autor pede que o mesmo nao seja copiado
Ao fim de " ModGlobal "
Adicine:
- Código:
'Pathfinding
Public MovXD As Integer
Public MovYD As Integer
Public MouseMove As Boolean
Adicine:
- Código:
' Set Default MouseMove Boolean to False
MouseMove = False
Procure por:
- Código:
Sub CheckInputKeys
Mude sua Sub inteira por:
- Código:
Public Sub CheckInputKeys()
' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler
If GetKeyState(vbKeyShift) < 0 Then
ShiftDown = True
Else
ShiftDown = False
End If
If GetKeyState(vbKeyReturn) < 0 Then
CheckMapGetItem
End If
If GetKeyState(vbKeyControl) < 0 Then
ControlDown = True
Else
ControlDown = False
End If
'Move Up
If GetKeyState(vbKeyUp) < 0 Then
DirUp = True
DirDown = False
DirLeft = False
DirRight = False
MouseMove = False
Exit Sub
Else
DirUp = False
End If
'Move Right
If GetKeyState(vbKeyRight) < 0 Then
DirUp = False
DirDown = False
DirLeft = False
DirRight = True
MouseMove = False
Exit Sub
Else
DirRight = False
End If
'Move down
If GetKeyState(vbKeyDown) < 0 Then
DirUp = False
DirDown = True
DirLeft = False
DirRight = False
MouseMove = False
Exit Sub
Else
DirDown = False
End If
'Move left
If GetKeyState(vbKeyLeft) < 0 Then
DirUp = False
DirDown = False
DirLeft = True
DirRight = False
MouseMove = False
Exit Sub
Else
DirLeft = False
End If
If (GetPlayerX(MyIndex) <> MovXD Or GetPlayerY(MyIndex) <> MovYD) And MouseMove Then
MoveNextStep
Else
MouseMove = False
End If
' Error handler
Exit Sub
errorhandler:
HandleError "CheckInputKeys", "modInput", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Sub
End Sub
- Código:
Public Sub MoveNextStep()
DirUp = False
DirDown = False
DirLeft = False
DirRight = False
If (Abs(MovXD - GetPlayerX(MyIndex)) > Abs(MovYD - GetPlayerY(MyIndex))) Then
'Move Right
If MovXD > GetPlayerX(MyIndex) Then
DirRight = True
'Move Left
Else
DirLeft = True
End If
Else
'Move Down
If MovYD > GetPlayerY(MyIndex) Then
DirDown = True
'Move Up
Else
DirUp = True
End If
End If
End Sub
Na sua " frmmain " na sub " MouseDown " ( Observaçao: Pode ser na Sub " Mousedown " ou na frmmain_Mousedown,mas tanto faz. )
- Código:
'Pathfinding
MouseMove = True
MovXD = CurX
MovYD = CurY
- Código:
Call CheckKeys
- Código:
' Call CheckKeys
Fim,se bugar podem comentar no tópico que eu arrumo ; )
Kisuke- Novato
- Mensagens : 0
Agradecimentos : 0
Data de inscrição : 20/09/2012
:: Eclipse Origins :: Tutoriais
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos
Seg Abr 08, 2013 7:18 pm por L Mars
» PlayGame chego !!
Qua Out 17, 2012 1:59 pm por PlayGame
» Dragon Ball Z Moster Online
Ter Out 16, 2012 8:19 pm por Myke ~
» [EEB]Sistema de Guerra ninja Basic Por ComandButton
Ter Out 16, 2012 8:14 pm por Myke ~
» Meus tutorias
Dom Out 14, 2012 4:55 pm por PlayGame
» Avaliem esse's desenho
Dom Out 14, 2012 4:36 pm por PlayGame
» Tutorial Mapper - Como avaliar um mapa
Sáb Out 13, 2012 4:52 pm por NeeTo
» Movimentação Wasd e Setas V2.0
Qui Out 11, 2012 6:14 pm por Myke ~
» Level Maximo 1000
Qui Out 11, 2012 6:10 pm por Myke ~