I've made another form to show that shows various information about the character you are playing as like their name, main stats like strength and secondary stats like evasion chance
Because, though, our variables for the various stats are stored on the main form we need to pass them through inheritance to this form.
Note: For now I've only manipulated the main stats, strength, agility and intelligence along with the character level, the other stats are just given a number directly on the form until I build on the program a bit more.
Main Form
Private Sub BtnChar_Click(sender As System.Object, e As System.EventArgs) Handles BtnChar.Click
'Open Character screen and pass variables to FrmChar
Dim frm As New FrmChar(Strength, Agility, Intelligence)
frm.Show()
End Sub
Character Form
Public Class FrmChar
'Declare public variables
Dim str As Integer
Dim agi As Integer
Dim int As Integer
Dim lvl As Integer
Public Sub New(ByVal Strength As Integer, ByVal Agility As Integer, ByVal Intelligence As Integer, ByVal Level As Integer)
'Inherit variables from FrmMain
InitializeComponent()
str = Strength
agi = Agility
int = Intelligence
lvl = Level
End Sub
Public Sub FrmChar_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim Name As String
Dim HP, MP, Armour, Power, Evade As Integer
'Show variable values in associated text boxes
Name = "Andrew Baldie"
HP = 500000
MP = 500
Armour = 27890
Power = 39020
Evade = 5
TxtName.Text = Name
TxtLevel.Text = lvl
TxtStr.Text = str
TxtAgi.Text = agi
TxtInt.Text = int
TxtHP.Text = HP
TxtMP.Text = MP
TxtArmour.Text = Armour
TxtPower.Text = Power
TxtEvade.Text = Evade
End Sub
End Class
No comments:
Post a Comment