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

Add a Walk and Run option in option menu EO


Whitepinkbun
 Share

Recommended Posts

So I'm more into spriting but i thought i should contribute something little that may help people starting out on vb6.

This is to replace the "Holding shift key to run" with a run/walk option in the option menu.

First things first open frmMain and create 2 option buttons in the picOptions picture box label them OptW Labeled Walk and OptR labeled Run make sure the value of walk or run is True.

Next open modGameLogic and find the sub CheckMovement ()
and replace
```
            ' Check if player has the shift key down for running
            If ShiftDown Then
```with
```
            ' Check if player has the run option enabled for running
            If frmMain.OptW.Value = True Then
```
And wala easy as pie simple but a feature i'm using in my game none the less hope this helps people starting out with grasping VB6 concepts  :cheesy:
Link to comment
Share on other sites

Yes it is possible I haven't gone through the game code enough to explain 15 min before work how to but I believe it possible perhaps someone else can help u through it.. I'm thinking another folder add it as a directory and have the game check if your character is running or walking and show the sprite in response to which ever it is… When i get home ill have a real look for you! XD
Link to comment
Share on other sites

What you've done isn't really an option.

This would be how to add an actual option:

Go to modTypes and scroll down to the "OptionsRec".

Before the "End Type" add:

```
Movement as Byte
```
In modDatabase find:

```
Call PutVar(fileName, "Options", "Debug", Str(Options.Debug))
```
And under it add:

```
Call PutVar(fileName, "Options", "Movement", Str(Options.Movement))
```
Still in modOptions, in Sub LoadOptions under

```
Options.Debug = 0
```
Add:

```
Options.Movement = 0
```
Under:

```
Options.Debug = GetVar(fileName, "Options", "Debug")
```
Add:

```
Options.Movement = GetVar(fileName, "Options", "Movement")
```
Before "Error handler", add:

```
If Options.Movement = 0 Then
        frmMain.optW.Value = True
    Else
        frmMain.optR.Value = True
    End If
```
Finally, add these two subs at the end of the frmMain code:

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

    Options.Movement = 0
    ' save to config.ini
    SaveOptions

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

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

    Options.Movement = 1
    ' save to config.ini
    SaveOptions

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "optR_Click", "frmMain", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub
```
Thats it for the code. Remember to add: Movement= 0 in your config.ini.
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...