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

Jumping


Ravenshade
 Share

Recommended Posts

Just in case I'd want to add any other action, can someone tell me if there's a tutorial about adding another action? Such as jumping…or climbing? I ran a search but pulled nothing >.<;

All help appreciated, as to what I'd have to edit in order to code it myself as I don't know where the existing information is >.<
Link to comment
Share on other sites

That was…very helpful of you. I think I've figured on the section, so any input would be helpful however...

I'm thinking of editing the client side code...:

Please note this is not a solution it's a WIP and doesn't yet work.

Notes...

>! This doesn't let NPC's jump.
>! End Notes

In ModGameLogic
```
Sub CheckMovement()
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    If IsTryingToMove Then
        If CanMove Then

            ' Check if player has the shift key down for running
            If ShiftDown Then
                Player(MyIndex).Moving = MOVING_RUNNING
            Else
                Player(MyIndex).Moving = MOVING_WALKING

            End If

        'Jump Mod
            'Check if player has AltGr key down for jumping
            If AltGrDown Then
                Player(MyIndex).Moving = MOVING_JUMPING
            Else
                Player(MyIndex).Moving = MOVING_WALKING
            End If 
        'End Jump Mod

            Select Case GetPlayerDir(MyIndex)
                Case DIR_UP
                    Call SendPlayerMove
                    Player(MyIndex).YOffset = PIC_Y
                    Call SetPlayerY(MyIndex, GetPlayerY(MyIndex) - 1)
                Case DIR_DOWN
                    Call SendPlayerMove
                    Player(MyIndex).YOffset = PIC_Y * -1
                    Call SetPlayerY(MyIndex, GetPlayerY(MyIndex) + 1)
                Case DIR_LEFT
                    Call SendPlayerMove
                    Player(MyIndex).XOffset = PIC_X
                    Call SetPlayerX(MyIndex, GetPlayerX(MyIndex) - 1)
                Case DIR_RIGHT
                    Call SendPlayerMove
                    Player(MyIndex).XOffset = PIC_X * -1
                    Call SetPlayerX(MyIndex, GetPlayerX(MyIndex) + 1)
            End Select

            If Player(MyIndex).XOffset = 0 Then
                If Player(MyIndex).YOffset = 0 Then
                    If Map.Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex)).Type = TILE_TYPE_WARP Then
                        GettingMap = True
                    End If
                End If
            End If
        End If
    End If

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "CheckMovement", "modGameLogic", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub
```
```
Sub ProcessMovement(ByVal Index As Long)
Dim MovementSpeed As Long

    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    ' Check if player is walking, and if so process moving them over
    Select Case Player(Index).Moving
        Case MOVING_WALKING: MovementSpeed = ((ElapsedTime / 1000) * (RUN_SPEED * SIZE_X))
        Case MOVING_RUNNING: MovementSpeed = ((ElapsedTime / 1000) * (WALK_SPEED * SIZE_X))
    'Jump Mod   
        Case MOVING_JUMPING: MovementSpeed = ((ElapsedTime/1000) * (RUN_SPEED * SIZE_X))
    'End Jump Mod
        Case Else: Exit Sub
    End Select

    Select Case GetPlayerDir(Index)
        Case DIR_UP
            Player(Index).YOffset = Player(Index).YOffset - MovementSpeed
            If Player(Index).YOffset < 0 Then Player(Index).YOffset = 0
        Case DIR_DOWN
            Player(Index).YOffset = Player(Index).YOffset + MovementSpeed
            If Player(Index).YOffset > 0 Then Player(Index).YOffset = 0
        Case DIR_LEFT
            Player(Index).XOffset = Player(Index).XOffset - MovementSpeed
            If Player(Index).XOffset < 0 Then Player(Index).XOffset = 0
        Case DIR_RIGHT
            Player(Index).XOffset = Player(Index).XOffset + MovementSpeed
            If Player(Index).XOffset > 0 Then Player(Index).XOffset = 0
    End Select

    ' Check if completed walking over to the next tile
    If Player(Index).Moving > 0 Then
        If GetPlayerDir(Index) = DIR_RIGHT Or GetPlayerDir(Index) = DIR_DOWN Then
            If (Player(Index).XOffset >= 0) And (Player(Index).YOffset >= 0) Then
                Player(Index).Moving = 0
                If Player(Index).Step = 1 Then
                    Player(Index).Step = 3
                Else
                    Player(Index).Step = 1
                End If
            End If
        Else
            If (Player(Index).XOffset <= 0) And (Player(Index).YOffset <= 0) Then
                Player(Index).Moving = 0
                If Player(Index).Step = 1 Then
                    Player(Index).Step = 3
                Else
                    Player(Index).Step = 1
                End If
            End If
        End If
    End If

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

```
In ModConstants
```
' Constants for player movement: Tiles per Second
Public Const MOVING_WALKING As Byte = 1
Public Const MOVING_RUNNING As Byte = 2
'Jump Mod
Public Const MOVING_JUMPING As Byte = 3
'End Jump Mod

```
Edited further

In modGlobals
```
' Game direction vars
Public DirUp As Boolean
Public DirDown As Boolean
Public DirLeft As Boolean
Public DirRight As Boolean
Public ShiftDown As Boolean
Public ControlDown As Boolean
'Jump Mod
Public AltGrDown As Boolean
'End Jump Mod

```
In modInput
```
Public Sub CheckKeys()
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    If GetAsyncKeyState(VK_UP) >= 0 Then DirUp = False
    If GetAsyncKeyState(VK_DOWN) >= 0 Then DirDown = False
    If GetAsyncKeyState(VK_LEFT) >= 0 Then DirLeft = False
    If GetAsyncKeyState(VK_RIGHT) >= 0 Then DirRight = False
    If GetAsyncKeyState(VK_CONTROL) >= 0 Then ControlDown = False
    If GetAsyncKeyState(VK_SHIFT) >= 0 Then ShiftDown = False
    'Jump Mod
        If GetAsyncKeyState(VK_RMENU) >= 0 Then AltGrDown = False
    'End Jump Mod

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

```
Link to comment
Share on other sites

You asked if there was a tutorial. I pointed out that there isn't one.

As it is without a tutorial there's really nothing you can do. Those kinds of systems would require a hell of a lot more programming experience than you have.

Choose something a bit easier to learn with. Jumping that far in to the deep end will just cause you to drown.
Link to comment
Share on other sites

I edited my post just above. As it is, you don't want to help, so don't. Feel free to ignore my threads. I am working on the code myself. You don't have to like it.

Edit

Do you know how I was taught to swim? I was chucked into the deep end of the reservoir. I'm still here.
Link to comment
Share on other sites

@Harris:

> Robin, obviously your general expectations of new Eclipse members is pretty low but I think this guy knows what he's doing.

Last thread he actually argued with me about the ramifications of re-purposing one of the core engine procedures to do something other than what the rest of the engine expected it to do.

@Ravenshade:

> Do you know how I was taught to swim? I was chucked into the deep end of the reservoir. I'm still here.

Unfortunately you were born with the instinct pre-programmed in to your brain. Hell, you spent 9 months practising to hold your breath before you even came out.

As for your claim that I'm not willing to help… well, I'll call bullshit on that one. I'm more than willing to help but when you have no understanding of client-server relationships, no understanding of basic procedure structure and an overwhelming urge to ignore my advice then I'm really not going to waste my time.

Jumping requires knowledge of the rendering routines, packet systems and movement systems. At least.

Go mess around with slightly /less/ ambitious projects to learn the basics and then move up to something that requires that much.

Otherwise you're just going to end up doing it wrong. If we're going to push the swimming analogy even further I think it's safe to say you drowned as soon as you tried re-purposing GetPlayerStat().
Link to comment
Share on other sites

Look, if you don't want to accept that my solution works for me (and I've now extensively tested, I can find nothing, absolutely nothing broken) that is up to you.

Admittedly, this is a very big project for me, which is why, everything is segmented and I already do regular back ups so that if I do something seriously wrong, I can always roll back. I am learning how to do things and if this comes to nothing, then it comes to nothing, but at least I can say I tried rather than having never tried at all.
Link to comment
Share on other sites

@Ravenshade:

> Look, if you don't want to accept that my solution works for me (and I've now extensively tested, I can find nothing, absolutely nothing broken) that is up to you.
>
> Admittedly, this is a very big project for me, which is why, everything is segmented and I already do regular back ups so that if I do something seriously wrong, I can always roll back. I am learning how to do things and if this comes to nothing, then it comes to nothing, but at least I can say I tried rather than having never tried at all.

That's fine. That's great, even. Having a formula that works for you is important.

However, when you start venturing in to the Q&A section there are a few things you give up. When you ask a question then you need to accept the answer, especially if it comes from me. If I say your code is going to break the engine then your code is going to break the engine. That's just how it is.

If you want to ignore me then that's fine too. But what happens when you do that is that you lose my favour and you start to annoy me. You see, we've got a long history of people who ask questions and then act up when they don't like the answer. As such we have a way of dealing with these people. The age old cry of, "I don't see anything wrong with it", will just piss everyone off. It's the kind of arrogance that is detrimental to the community.

If you want to use the forum for support then you need to accept that support. Otherwise your ability to ask for support will be removed.

In the mean time I've already explained what you need to learn before you can even attempt to make a jumping system. If you don't know how to edit the rendering routines or how to send a packet then there is literally no way you can do anything in this engine.

Go learn those skills. Once you have you won't need to ask people to explain how to make the system.
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...