Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

EO (1.3) Mouse Movement Tutorial


Rob Janes
 Share

Recommended Posts

  • Replies 66
  • Created
  • Last Reply

Top Posters In This Topic

@BugSICK:

> but its really not working, done two times… :(

hmm… odd. what verison you using? and read over it very carefully like each code . the first time when i attempt it half of the code got cut off and i could on click to the right using left clicks.
Link to comment
Share on other sites

@BugSICK:

> im using the current version the EO1.5

oh then you might of miss something make sure each code is word from word. also make sure the call checkkeys is 'call checkkeys. also dont put a ' infront of the 'call checkinputkeys. that where i mess up also :P .
Link to comment
Share on other sites

heres my code:
the step 1 and 2 are easy.

this is step 3 forward.

>! 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

    'Quickly Check to See if we are using MouseMovement, if so, exit sub and don't check Keyboard Movement
    If MouseMove = True Then
        Exit Sub
    End If
>!     'Move Up
    If GetKeyState(vbKeyUp) < 0 Then
        DirUp = True
        DirDown = False
        DirLeft = False
        DirRight = False
        Exit Sub
    Else
        DirUp = False
    End If
>!     'Move Right
    If GetKeyState(vbKeyRight) < 0 Then
        DirUp = False
        DirDown = False
        DirLeft = False
        DirRight = True
        Exit Sub
    Else
        DirRight = False
    End If
>!     'Move down
    If GetKeyState(vbKeyDown) < 0 Then
        DirUp = False
        DirDown = True
        DirLeft = False
        DirRight = False
        Exit Sub
    Else
        DirDown = False
    End If
>!     'Move left
    If GetKeyState(vbKeyLeft) < 0 Then
        DirUp = False
        DirDown = False
        DirLeft = True
        DirRight = False
        Exit Sub
    Else
        DirLeft = 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

>! Private Sub picScreen_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler
>!     If InMapEditor Then
        Call MapEditorMouseDown(Button, x, y, False)
    Else
        ' left click
        If Button = vbLeftButton Then
            ' targetting
            Call PlayerSearch(CurX, CurY)
        ' right click
        ElseIf Button = vbRightButton Then
        MouseMove = True

            'Right Click Mouse Movement Here, Give MyX and MyY values for current Pos then compare
>!             MyX = GetPlayerX(MyIndex)
            MyY = GetPlayerY(MyIndex)
>!             'Move Right
            If CurX > MyX Then
                DirUp = False
                DirDown = False
                DirLeft = False
                DirRight = True
          End If
>!             'Move Left
            If CurX < MyX Then
                DirUp = False
                DirDown = False
                DirLeft = True
                DirRight = False
            End If

            'Move Down
            If CurY > MyY Then
                DirUp = False
                DirDown = True
                DirLeft = False
                DirRight = False
            End If
            'Move Up
            If CurY < MyY Then
                DirUp = True
                DirDown = False
                DirLeft = False
                DirRight = False
            End If

            If ShiftDown Then
                ' admin warp if we're pressing shift and right clicking
                If GetPlayerAccess(MyIndex) >= 2 Then AdminWarp CurX, CurY
            End If
        End If
    End If
>!     Call SetFocusOnChat

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "picScreen_MouseDown", "frmMain", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

>! Private Sub picShop_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
MouseMove = False
End Sub

>! Public Sub GameLoop()
' Call CheckKeys
Dim FrameTime As Long
Dim Tick As Long
Dim TickFPS As Long
Dim FPS As Long
Dim i As Long
Dim WalkTimer As Long
Dim tmr25 As Long
Dim tmr100 As Long
Dim tmr10000 As Long
Link to comment
Share on other sites

@BugSICK:

> what? didnt understand.  :sad:(noob here)

me and you both lol we both new at it but anyway . at the last step of it make sure you dont get ahead of your self like i did :P cuz you only need to change call checkkeys to ' call checkkeys . dont change the input one cuz that will mess up your code for walking using arrows keys.
Link to comment
Share on other sites

  • 4 weeks later...
  • 1 month later...
Hmm… My code looks good to me, but it's really glitchy.
It acts like it's not getting my mouse position correctly, because I can click the same random spot four different times and go a different direction each time haha. Any ideas on why it rarely goes the right direction?
Link to comment
Share on other sites

  • 2 weeks later...
@SamuGames:

> You can add the actual movement part from MouseDown to MouseMouse on the frmMain picScreen object so that way if you're holding down the mouse and change direction it'll automatically update the movement direction.

MouseMouse? Where's that?
Link to comment
Share on other sites

  • 2 months later...
Hello everyone. I'm new to this forum so hello. I am making a game wih EE 2.7 and was wondering if anyone knows a way to implement this mouse movement in the EE version.

It would be greaty if someone could help me with this.

YoRan
Link to comment
Share on other sites

Oke. I started using EE because EO started with settings in place and I don't know how to start fresh. My game is already well underway, a same to start over.  but if you realy recommend EO I will consider it. I hope you might be able to tell me what makes EO so much better.
Link to comment
Share on other sites

@Yoran:

> Oke. I started using EE because EO started with settings in place and I don't know how to start fresh. My game is already well underway but if you realy recommend EO I will consider it. I hope might be able to tell me what makes EO so much better.

Then read this.
http://www.touchofdeathforums.com/eclipse/
Link to comment
Share on other sites

Thanks alot for all of your quick replies. I also read http://www.touchofdeathforums.com/smf/index.php?topic=71334.0 witch pretty much convinced me completely.

So the only thing that bothered me was the map that was already in place. So i should just edit this and delete to put in my own?

Love the forum, love the posts and love the fact I'm making my own game :P

PS> VB works with EO? because I eventualiy want to change the stat names.

On an other topic. If i want to use skills for people in my game (this was already able on EE) can i also have it so peple can view their stats on their profile. Maybe this is selfexplanitory on EO, but since you guys are so fast at replying i thought I'd throw it in their.

Thanks again for the support.

Yoran
Link to comment
Share on other sites

I can't seem to get the mapeditor to work in EO. I made myself admin and pressed F1 an typed in /mapeditor but nothing happend…

Does anyone know whats wrong?

- sorry,  I found it in FAQ :P just have to press insert -
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share


×
×
  • Create New...