Tuesday, 22 October 2013

Statistical Stats!

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

Monday, 21 October 2013

Oh noes (invisible) monsters ;_;

Decided to implement a counter which upon reaching 0 will trigger a form to appear in which a random battle will occur (in a similar vein to how the first couple of Final Fantasy games handled random encounters)

Private Sub Random_Encounter(ByRef Counter As Integer)

Counter = Counter - 5
If Counter <= 0 Then

FrmBattle.ShowDialog()

Counter = CInt(Int((255 - 50 + 1) * Rnd())) + 50 + 1

End If

End Sub

I've so far only built the trigger, the subsequent building of what appears on the form and the battle mechanics of the monsters while be done later on :)

This is also the start of a big block of updates as I've been pretty bad with updating my blog, I'm sorry!