1 Replies - 143 Views - Last Post: 09 February 2020 - 10:32 AM Rate Topic: -----

#1 Yeshuah   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 06-October 17

Leveling System for Game

Posted 09 February 2020 - 09:47 AM

Hello, I have previous experience in game development, and want to try to see if I can make an in-depth game in VB, as the games I've seen are super basic.

Basically, Ive made a few Leveling systems in the past but i cant seem to remember how I made it work; Heres my codes now:

Public Module GlobalVariables
    Public currentLevel As Integer = 1
    Public prevLevel As Integer = currentLevel - 1
    Public maxLevel As Integer = 100
    Public currentEXP As Integer = 1
    Public maxEXP As Integer = 30
    Public expOverflow As Integer = 0

End Module


Imports System.Math

Module GlobalFunctions
    Public Function levelUp()
        expOverflow = currentEXP - maxEXP
        currentEXP = expOverflow
        currentLevel += 1
        maxEXP = prevLevel * 1.2 + 5
        Return currentLevel
    End Function

    Public Function GiveEXP(EXP As Integer)
        currentEXP += EXP
        If currentEXP >= maxEXP Then
            levelUp()
        End If
        Return currentEXP
    End Function
End Module


I have a button, a few labels, and a progress bar(to display experience)

The button calls the GiveEXP(n) function the labels display current level, current exp and max exp.

But this doesnt work, what am I missing?

Is This A Good Question/Topic? 0
  • +

Replies To: Leveling System for Game

#2 Yeshuah   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 06-October 17

Re: Leveling System for Game

Posted 09 February 2020 - 10:32 AM

Got it, for anyone interested, All I did was change the math for maxEXP on levelUp()

Public Function levelUp()
        expOverflow = currentEXP - maxEXP
        currentEXP = expOverflow
        currentLevel += 1
        maxEXP = (currentLevel / 0.32) ^ 2
        Return currentLevel
    End Function

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1