Note: I will update this as new video's are released.
Tutorial.vb
Code: Select all
Module Tutorial
Sub Main()
PrintTitle.ShowTitle()
PrintTitle.ShowStatus()
Player.Swing()
End Sub
End Module
Code: Select all
Public Class PrintTitle
Public Shared Sub ShowTitle()
Console.WriteLine("Welcome to Kill a Kobold!")
Console.ReadKey()
End Sub
Public Shared Sub ShowStatus()
Console.Clear()
Console.Write("Player " & vbNewLine & "**************" & vbNewLine)
Console.WriteLine("Attack: " & Player.Attack)
Console.WriteLine("Defense: " & Player.Defense)
Console.WriteLine("Hit Points: " & Player.HitPoints)
Console.Write(vbNewLine & vbNewLine)
Console.Write("Kobold " & vbNewLine & "**************" & vbNewLine)
Console.WriteLine("Attack: " & Kobold.Attack)
Console.WriteLine("Defense: " & Kobold.Defense)
Console.WriteLine("Hit Points: " & Kobold.HitPoints)
Console.Write(vbNewLine & "Press a key to Attack")
Console.ReadKey()
If Kobold.HitPoints > 0 And Player.HitPoints > 0 Then
Player.Swing()
Else
Console.Clear()
Console.WriteLine("Game Over")
Console.ReadKey()
End If
End Sub
End Class
Code: Select all
Public Class AttackFunctions
Shared Function Attack1() As Integer
Dim playerattack As Integer = 5
Dim creaturedefense As Integer = 3
Dim finalattack As Integer = playerattack - creaturedefense
Return finalattack
End Function
End Class
Code: Select all
Public Class Player
Private Shared p_attack As Integer = 5
Private Shared p_defense As Integer = 5
Private Shared p_hitpoints As Integer = 10
Private Shared p_damage As Integer = 3
Public Shared Property Attack As Integer
Get
Return p_attack
End Get
Set(value As Integer)
p_attack = value
End Set
End Property
Public Shared Property Defense As Integer
Get
Return p_defense
End Get
Set(value As Integer)
p_defense = value
End Set
End Property
Public Shared Property HitPoints As Integer
Get
Return p_hitpoints
End Get
Set(value As Integer)
p_hitpoints = value
End Set
End Property
Public Shared Property Damage As Integer
Get
Return p_damage
End Get
Set(value As Integer)
p_damage = value
End Set
End Property
Public Shared Sub Swing()
If Player.HitPoints < 1 Or Kobold.HitPoints < 1 Then
Return
End If
Console.Clear()
Console.Write("Player swings and ")
Dim attackroll As New Random
Dim finalroll = attackroll.Next(1, 6)
Dim finalattackroll = finalroll + Attack
Dim defenseroll As New Random
Dim finaldefenseroll = defenseroll.Next(1, 6)
Dim finalkobolddefense = finaldefenseroll + Kobold.Defense
If finalattackroll > finalkobolddefense Then
Console.Write("HITS! " & vbNewLine & " For ")
Dim damageroll As New Random
Dim finaldamage = damageroll.Next(1, Damage)
Kobold.HitPoints -= finaldamage
Console.Write(finaldamage & " points of damage." & vbNewLine & " Press any key to continue.")
Console.ReadKey()
If Kobold.HitPoints < 1 Then
Console.WriteLine(vbNewLine & "You have killed the Kobold!")
Console.WriteLine("You Win!")
Console.ReadKey()
Return
Else
Kobold.Swing()
End If
Else
Console.Write("Missed")
Console.ReadKey()
End If
End Sub
End Class
Code: Select all
Public Class Kobold
Private Shared k_attack As Integer = 3
Private Shared k_defense As Integer = 3
Private Shared k_hitpoints As Integer = 6
Private Shared k_damage As Integer = 2
Public Shared Property Attack As Integer
Get
Return k_attack
End Get
Set(value As Integer)
k_attack = value
End Set
End Property
Public Shared Property Defense As Integer
Get
Return k_defense
End Get
Set(value As Integer)
k_defense = value
End Set
End Property
Public Shared Property HitPoints As Integer
Get
Return k_hitpoints
End Get
Set(value As Integer)
k_hitpoints = value
End Set
End Property
Public Shared Property Damage As Integer
Get
Return k_damage
End Get
Set(value As Integer)
k_damage = value
End Set
End Property
Public Shared Sub Swing()
Console.Clear()
Console.Write("Kobold swings and ")
Dim attackroll As New Random
Dim finalroll = attackroll.Next(1, 6)
Dim finalattackroll = finalroll + Attack
Dim defenseroll As New Random
Dim finaldefenseroll = defenseroll.Next(1, 6)
Dim finalplayerdefense = finaldefenseroll + Player.Defense
If finalattackroll > finalplayerdefense Then
Console.Write("HITS! " & vbNewLine & " For ")
Dim damageroll As New Random
Dim finaldamage = damageroll.Next(1, Damage)
Player.HitPoints -= finaldamage
Console.Write(finaldamage & " points of damage." & vbNewLine & " Press any key to continue.")
Console.ReadKey()
If Player.HitPoints < 1 Then
Console.WriteLine(vbNewLine & "You have been killed!")
Console.WriteLine("You Lose!")
Console.ReadKey()
Return
Else
PrintTitle.ShowStatus()
End If
Else
Console.Write("Missed")
Console.ReadKey()
PrintTitle.ShowStatus()
End If
End Sub
End Class
http://www.mediafire.com/?2rfryrnvlxhr62o