My first real game

Discussion in 'Game Development General Discussion' started by opethfan, Jun 16, 2007.

  1. opethfan

    opethfan Dauntless Member

    Joined:
    Dec 13, 2006
    Messages:
    753
    Likes Received:
    2
    Hey guys, yesterday I finished making my first ever real game, in VB6. It's like a 2D Final Fantasy battle, with respawing enemies.
    A few things I want to fix:
    - If a party member is dead, hit a different one.
    - The enemy should use magic too
    - Animations for attacking, potions, pheonix downs and ethers
    - The hit timer's not quite perfect.
    - Clean up the code, use more sub procedures, less If statements.
    But apart from those minor issues, I think it's pretty good. Don't be too harsh with the criticism please, I've only been coding VB since February.

    http://www.megaupload.com/?d=Z27XB4UX
    BTW, I compiled the exe myself just now, It's safe. I've got the frm file and all images there too, and the code.
     
  2. ph4nth0m

    ph4nth0m <B>Site Supporter 2012</B><BR><B>Site Supporter 20

    Joined:
    Jun 4, 2007
    Messages:
    164
    Likes Received:
    0
    it's a good game i think ! very good i think for a first game!:thumbsup:
     
  3. Smithy

    Smithy Spirited Member

    Joined:
    Jul 22, 2005
    Messages:
    185
    Likes Received:
    0
    Great job with that, that must have taken alot of work in VB6, that was my first 'real' language too =)
     
  4. 3do

    3do Segata Sanshiro!

    Joined:
    Sep 25, 2006
    Messages:
    1,901
    Likes Received:
    12
    Pretty good game, I don't really know much about VB6 as i have used a newer version but very good
     
  5. opethfan

    opethfan Dauntless Member

    Joined:
    Dec 13, 2006
    Messages:
    753
    Likes Received:
    2
    For shits and giggles I post the code. If any VB experts want to help me sort out the code, especially the massive If statement on Enemy1turn, it'd be very much appreciated :)

    'Kieran Bullen - Final Fantasy Survival
    'Final Fantasy name and artwork are property of Square Enix
    'Version 1.3 - June 14th 2007
    'Fixed: MP\Ether Bug

    Option Explicit
    'Attack Variables
    Private bolAttack As Boolean
    Private bolFire As Boolean
    Private bolFira As Boolean
    Private bolThunder As Boolean
    Private bolBlizzard As Boolean
    Private bolPotion As Boolean
    Private bolDown As Boolean
    Private bolEther As Boolean
    'How many items
    Private intPotion As Integer
    Private intDown As Integer
    Private intEther As Integer
    'Who's Dead
    Private bolCloudKO As Boolean
    Private bolTifaKO As Boolean
    Private bolBarretKO As Boolean
    'Decides who goes next
    'Cloud = 1, Tifa = 2, Barret = 3, Enemy = 4
    Private intWhosMove As Integer
    'Health and Magic
    Private intCloudHP As Integer
    Private intCloudMP As Integer
    Private intTifaHP As Integer
    Private intTifaMP As Integer
    Private intBarretHP As Integer
    Private intBarretMP As Integer
    Private intEnemy1HP As Integer
    'That bar at the top
    Private strHelp As String
    'How many enemies you killed
    Private intCounter As Integer
    Private intEnTotal As Integer

    Sub NewEnemy()
    'Once an enemy is killed, a new one is spawned
    Dim intWhoNext As Integer

    Call ButtonsEnable
    intCounter = intCounter + 1
    intPotion = intPotion + 3
    intDown = intDown + 3
    intEther = intEther + 3
    cmdPotion.Caption = "Potion - " & intPotion
    cmdDown.Caption = "Pheonix Down - " & intDown
    cmdEther.Caption = "Ether - " & intEther
    Randomize
    intEnTotal = Rnd * 4999 + 5000
    intEnemy1HP = intEnTotal
    lblEnemy1HP.Caption = intEnemy1HP & "\" & intEnTotal
    intWhoNext = intCounter

    If intWhoNext > 10 Then
    Randomize
    intWhoNext = Rnd * 9 + 1
    End If

    If intWhoNext = 1 Then
    picEnemy1.Picture = picEnemy2.Picture
    ElseIf intWhoNext = 2 Then
    picEnemy1.Picture = picEnemy3.Picture
    ElseIf intWhoNext = 3 Then
    picEnemy1.Picture = picEnemy4.Picture
    ElseIf intWhoNext = 4 Then
    picEnemy1.Picture = picEnemy5.Picture
    ElseIf intWhoNext = 5 Then
    picEnemy1.Picture = picEnemy6.Picture
    ElseIf intWhoNext = 6 Then
    picEnemy1.Picture = picEnemy7.Picture
    ElseIf intWhoNext = 7 Then
    picEnemy1.Picture = picEnemy8.Picture
    ElseIf intWhoNext = 8 Then
    picEnemy1.Picture = picEnemy9.Picture
    ElseIf intWhoNext = 9 Then
    picEnemy1.Picture = picEnemy10.Picture
    ElseIf intWhoNext = 10 Then
    picEnemy1.Picture = picEnemy11.Picture
    End If

    picEnemy1.Visible = True
    lblEnemy1HP.Visible = True

    If intWhosMove = 1 Then
    Call CloudsMove
    ElseIf intWhosMove = 2 Then
    picCloud.Move picCloud.Left - 350
    Call TifasMove
    ElseIf intWhosMove = 3 Then
    picTifa.Move picTifa.Left - 350
    Call BarretsMove
    ElseIf intWhosMove = 4 Then
    picBarret.Move picBarret.Left - 350
    Call Enemy1Move
    End If
    End Sub

    Private Sub cmdAttack_Click()
    Call ButtonsDisable
    fraMagic.Visible = False
    bolAttack = True

    If intWhosMove = 1 Then
    strHelp = "Cloud's Move : Attack"
    ElseIf intWhosMove = 2 Then
    strHelp = "Tifa's Move : Attack"
    ElseIf intWhosMove = 3 Then
    strHelp = "Barrets's Move : Attack"
    End If

    lblHelp.Caption = strHelp
    End Sub

    Function Attack() As Integer
    Randomize
    Attack = Rnd * 200 + 125
    End Function

    Private Sub cmdBlizzard_Click()
    bolBlizzard = True
    Call ButtonsDisable

    If intWhosMove = 1 Then
    strHelp = "Cloud's Move : Blizzard"
    ElseIf intWhosMove = 2 Then
    strHelp = "Tifa's Move : Blizzard"
    ElseIf intWhosMove = 3 Then
    strHelp = "Barrets's Move : Blizzard"
    End If

    lblHelp.Caption = strHelp
    End Sub

    Private Sub cmdCancel_Click()
    'Cancels the selected move and reenables the buttons
    If AllDead = False And intWhosMove <> 4 Then
    fraMagic.Visible = False
    fraItems.Visible = False
    Call ButtonsEnable
    bolAttack = False
    bolFire = False
    bolFira = False
    bolPotion = False
    bolDown = False
    bolEther = False
    bolThunder = False
    bolBlizzard = False

    If intWhosMove = 1 Then
    strHelp = "Cloud's Move"
    ElseIf intWhosMove = 2 Then
    strHelp = "Tifa's Move"
    ElseIf intWhosMove = 3 Then
    strHelp = "Barrets's Move"
    ElseIf intWhosMove = 4 Then
    strHelp = "Enemy " & intCounter & "'s Move"
    End If

    lblHelp.Caption = strHelp
    End If
    End Sub

    Private Sub cmdDown_Click()
    bolDown = True
    Call ButtonsDisable

    If intWhosMove = 1 Then
    strHelp = "Cloud's Move : Pheonix Down"
    ElseIf intWhosMove = 2 Then
    strHelp = "Tifa's Move : Pheonix Down"
    ElseIf intWhosMove = 3 Then
    strHelp = "Barrets's Move : Pheonix Down"
    End If

    lblHelp.Caption = strHelp
    End Sub

    Private Sub cmdEther_Click()
    bolEther = True
    Call ButtonsDisable

    If intWhosMove = 1 Then
    strHelp = "Cloud's Move : Ether"
    ElseIf intWhosMove = 2 Then
    strHelp = "Tifa's Move : Ether"
    ElseIf intWhosMove = 3 Then
    strHelp = "Barrets's Move : Ether"
    End If

    lblHelp.Caption = strHelp
    End Sub

    Private Sub cmdFira_Click()
    bolFira = True
    Call ButtonsDisable

    If intWhosMove = 1 Then
    strHelp = "Cloud's Move : Fira"
    ElseIf intWhosMove = 2 Then
    strHelp = "Tifa's Move : Fira"
    ElseIf intWhosMove = 3 Then
    strHelp = "Barrets's Move : Fira"
    End If

    lblHelp.Caption = strHelp
    End Sub

    Private Sub cmdFire_Click()
    bolFire = True
    Call ButtonsDisable

    If intWhosMove = 1 Then
    strHelp = "Cloud's Move : Fire"
    ElseIf intWhosMove = 2 Then
    strHelp = "Tifa's Move : Fire"
    ElseIf intWhosMove = 3 Then
    strHelp = "Barrets's Move : Fire"
    End If

    lblHelp.Caption = strHelp
    End Sub

    Private Sub cmdItem_Click()
    fraItems.Visible = True
    fraMagic.Visible = False

    'If items are = 0, the button is disabled
    If intPotion = 0 Then
    cmdPotion.Enabled = False
    End If

    If intDown = 0 Then
    cmdDown.Enabled = False
    End If

    If intEther = 0 Then
    cmdEther.Enabled = False
    End If
    End Sub

    Private Sub cmdMagic_Click()
    fraMagic.Visible = True
    fraItems.Visible = False

    'If there is not enough MP for a move, it is disabled

    If intWhosMove = 1 Then

    If intCloudMP >= 35 Then
    cmdFire.Enabled = True
    cmdFira.Enabled = True
    cmdThunder.Enabled = True
    cmdBlizzard.Enabled = True
    ElseIf intCloudMP >= 25 Then
    cmdFire.Enabled = True
    cmdFira.Enabled = False
    cmdThunder.Enabled = True
    cmdBlizzard.Enabled = True
    Else
    cmdFire.Enabled = False
    cmdFira.Enabled = False
    cmdThunder.Enabled = False
    cmdBlizzard.Enabled = False
    End If

    ElseIf intWhosMove = 2 Then

    If intTifaMP >= 35 Then
    cmdFire.Enabled = True
    cmdFira.Enabled = True
    cmdThunder.Enabled = True
    cmdBlizzard.Enabled = True
    ElseIf intTifaMP >= 25 Then
    cmdFire.Enabled = True
    cmdFira.Enabled = False
    cmdThunder.Enabled = True
    cmdBlizzard.Enabled = True
    Else
    cmdFire.Enabled = False
    cmdFira.Enabled = False
    cmdThunder.Enabled = False
    cmdBlizzard.Enabled = False
    End If

    ElseIf intWhosMove = 3 Then

    If intBarretMP >= 35 Then
    cmdFire.Enabled = True
    cmdFira.Enabled = True
    cmdThunder.Enabled = True
    cmdBlizzard.Enabled = True
    ElseIf intBarretMP >= 25 Then
    cmdFire.Enabled = True
    cmdFira.Enabled = False
    cmdThunder.Enabled = True
    cmdBlizzard.Enabled = True
    Else
    cmdFire.Enabled = False
    cmdFira.Enabled = False
    cmdThunder.Enabled = False
    cmdBlizzard.Enabled = False
    End If

    End If
    End Sub

    Private Sub cmdPotion_Click()
    'Enable the potion and disable buttons
    bolPotion = True
    Call ButtonsDisable

    'Change the help bar
    If intWhosMove = 1 Then
    strHelp = "Cloud's Move : Potion"
    ElseIf intWhosMove = 2 Then
    strHelp = "Tifa's Move : Potion"
    ElseIf intWhosMove = 3 Then
    strHelp = "Barrets's Move : Potion"
    End If

    lblHelp.Caption = strHelp
    End Sub

    Private Sub cmdThunder_Click()
    'Enable the thunder boolean and disable buttons
    bolThunder = True
    Call ButtonsDisable

    'Update the help bar
    If intWhosMove = 1 Then
    strHelp = "Cloud's Move : Thunder"
    ElseIf intWhosMove = 2 Then
    strHelp = "Tifa's Move : Thunder"
    ElseIf intWhosMove = 3 Then
    strHelp = "Barrets's Move : Thunder"
    End If

    lblHelp.Caption = strHelp
    End Sub

    Private Sub lblEasterEgg_Click()
    MsgBox "Easter Egg!" & vbCrLf & vbCrLf & "Final Fantasy Survival" & vbCrLf & "By Kieran Bullen" & vbCrLf & "Version 1.3" & vbCrLf & "June 14th 2006" & vbCrLf & "Final Fantasy name and artwork are property of Square Enix."
    End Sub

    Private Sub picBarret_Click()
    If bolPotion = True Then
    bolPotion = False
    intBarretHP = intBarretHP + 250

    If intBarretHP > 1140 Then
    intBarretHP = 1140
    End If

    lblBarretHP.Caption = intBarretHP & "\1140"
    intPotion = intPotion - 1
    cmdPotion.Caption = "Potion - " & intPotion
    intWhosMove = intWhosMove + 1
    lblBarretHit.Caption = "250"
    tmrCharHitLength.Enabled = True

    If intWhosMove > 4 Then
    intWhosMove = 1
    End If

    If intWhosMove = 1 Then
    Call CloudsMove
    ElseIf intWhosMove = 2 Then
    picCloud.Move picCloud.Left - 350
    Call TifasMove
    ElseIf intWhosMove = 3 Then
    picTifa.Move picTifa.Left - 350
    Call BarretsMove
    ElseIf intWhosMove = 4 Then
    picBarret.Move picBarret.Left - 350
    Call Enemy1Move
    End If

    ElseIf bolEther = True Then
    intBarretMP = intBarretMP + 40

    If intBarretMP > 95 Then
    intBarretMP = 95
    End If

    bolEther = False
    lblBarretMP.Caption = intBarretMP & "\95"
    intEther = intEther - 1
    cmdEther.Caption = "Ether - " & intEther
    intWhosMove = intWhosMove + 1
    lblBarretHit.Caption = "40MP"
    tmrCharHitLength.Enabled = True

    If intWhosMove > 4 Then
    intWhosMove = 1
    End If

    If intWhosMove = 1 Then
    Call CloudsMove
    ElseIf intWhosMove = 2 Then
    picCloud.Move picCloud.Left - 350
    Call TifasMove
    ElseIf intWhosMove = 3 Then
    picTifa.Move picTifa.Left - 350
    Call BarretsMove
    ElseIf intWhosMove = 4 Then
    picBarret.Move picBarret.Left - 350
    Call Enemy1Move
    End If
    End If
    End Sub

    Private Sub picBarretKO_Click()
    If bolDown = True Then
    bolBarretKO = False
    bolDown = False
    intBarretHP = 300
    lblBarretHP.Caption = "300\1140"
    intDown = intDown - 1
    cmdDown.Caption = "Pheonix Down - " & intDown
    intWhosMove = intWhosMove + 1
    lblBarretHit.Caption = "300"
    tmrCharHitLength.Enabled = True
    picBarretKO.Visible = False

    If intWhosMove > 4 Then
    intWhosMove = 1
    End If

    If intWhosMove = 1 Then
    Call CloudsMove
    ElseIf intWhosMove = 2 Then
    picCloud.Move picCloud.Left - 350
    Call TifasMove
    ElseIf intWhosMove = 3 Then
    picTifa.Move picTifa.Left - 350
    Call BarretsMove
    ElseIf intWhosMove = 4 Then
    picBarret.Move picBarret.Left - 350
    Call Enemy1Move
    End If
    End If
    End Sub

    Private Sub picCloud_Click()
    If bolPotion = True Then
    bolPotion = False
    intCloudHP = intCloudHP + 250

    If intCloudHP > 1000 Then
    intCloudHP = 1000
    End If

    lblCloudHP.Caption = intCloudHP & "\1000"
    intPotion = intPotion - 1
    cmdPotion.Caption = "Potion - " & intPotion
    intWhosMove = intWhosMove + 1
    lblCloudHit.Caption = "250"
    tmrCharHitLength.Enabled = True

    If intWhosMove > 4 Then
    intWhosMove = 1
    End If

    If intWhosMove = 1 Then
    Call CloudsMove
    ElseIf intWhosMove = 2 Then
    picCloud.Move picCloud.Left - 350
    Call TifasMove
    ElseIf intWhosMove = 3 Then
    picTifa.Move picTifa.Left - 350
    Call BarretsMove
    ElseIf intWhosMove = 4 Then
    picBarret.Move picBarret.Left - 350
    Call Enemy1Move
    End If

    ElseIf bolEther = True Then
    intCloudMP = intCloudMP + 40

    If intCloudMP > 150 Then
    intCloudMP = 150
    End If

    bolEther = False
    lblCloudMP.Caption = intCloudMP & "\150"
    intEther = intEther - 1
    cmdEther.Caption = "Ether - " & intEther
    intWhosMove = intWhosMove + 1
    lblCloudHit.Caption = "40MP"
    tmrCharHitLength.Enabled = True

    If intWhosMove > 4 Then
    intWhosMove = 1
    End If

    If intWhosMove = 1 Then
    Call CloudsMove
    ElseIf intWhosMove = 2 Then
    picCloud.Move picCloud.Left - 350
    Call TifasMove
    ElseIf intWhosMove = 3 Then
    picTifa.Move picTifa.Left - 350
    Call BarretsMove
    ElseIf intWhosMove = 4 Then
    picBarret.Move picBarret.Left - 350
    Call Enemy1Move
    End If
    End If
    End Sub

    Private Sub picCloudKO_Click()
    If bolDown = True Then
    bolCloudKO = False
    bolDown = False
    intCloudHP = 300
    lblCloudHP.Caption = "300\1000"
    intDown = intDown - 1
    cmdDown.Caption = "Pheonix Down - " & intDown
    intWhosMove = intWhosMove + 1
    lblCloudHit.Caption = "300"
    tmrCharHitLength.Enabled = True
    picCloudKO.Visible = False

    If intWhosMove > 4 Then
    intWhosMove = 1
    End If

    If intWhosMove = 1 Then
    Call CloudsMove
    ElseIf intWhosMove = 2 Then
    picCloud.Move picCloud.Left - 350
    Call TifasMove
    ElseIf intWhosMove = 3 Then
    picTifa.Move picTifa.Left - 350
    Call BarretsMove
    ElseIf intWhosMove = 4 Then
    picBarret.Move picBarret.Left - 350
    Call Enemy1Move
    End If
    End If
    End Sub

    Private Sub picEnemy1_Click()
    Dim intAttack As Integer

    'Standard Attack
    If bolAttack = True Then
    intAttack = Attack
    intWhosMove = intWhosMove + 1
    lblEnemy1Hit.Visible = True
    lblEnemy1Hit.Caption = intAttack
    intEnemy1HP = intEnemy1HP - intAttack
    bolAttack = False
    lblEnemy1HP = intEnemy1HP & "\" & intEnTotal

    If intEnemy1HP <= 0 Then
    picEnemy1.Visible = False
    lblEnemy1HP.Visible = False
    lblHelp.Caption = "You win!"
    Call ButtonsDisable
    Call NewEnemy
    Else
    If intWhosMove > 4 Then
    intWhosMove = 1
    End If

    If intWhosMove = 1 Then
    Call CloudsMove
    ElseIf intWhosMove = 2 Then
    picCloud.Move picCloud.Left - 350
    Call TifasMove
    ElseIf intWhosMove = 3 Then
    picTifa.Move picTifa.Left - 350
    Call BarretsMove
    ElseIf intWhosMove = 4 Then
    picBarret.Move picBarret.Left - 350
    Call Enemy1Move
    End If
    End If

    tmrHitLength.Enabled = True

    'Fire Attack
    ElseIf bolFire = True Then
    intAttack = FiraAttack
    intWhosMove = intWhosMove + 1
    lblEnemy1Hit.Visible = True
    lblEnemy1Hit.Caption = intAttack
    intEnemy1HP = intEnemy1HP - intAttack
    bolFire = False
    lblEnemy1HP = intEnemy1HP & "\" & intEnTotal
    fraMagic.Visible = False
    picFire.Visible = True

    If intEnemy1HP <= 0 Then
    picEnemy1.Visible = False
    lblEnemy1HP.Visible = False
    lblHelp.Caption = "You win!"
    Call ButtonsDisable
    Else
    If intWhosMove > 4 Then
    intWhosMove = 1
    End If

    If intWhosMove = 1 Then
    Call CloudsMove
    ElseIf intWhosMove = 2 Then
    picCloud.Move picCloud.Left - 350
    intCloudMP = intCloudMP - 25
    lblCloudMP.Caption = intCloudMP & "\150"
    Call TifasMove
    ElseIf intWhosMove = 3 Then
    picTifa.Move picTifa.Left - 350
    intTifaMP = intTifaMP - 25
    lblTifaMP.Caption = intTifaMP & "\184"
    Call BarretsMove
    ElseIf intWhosMove = 4 Then
    picBarret.Move picBarret.Left - 350
    intBarretMP = intBarretMP - 25
    lblBarretMP.Caption = intBarretMP & "\95"
    Call Enemy1Move
    End If
    End If

    tmrHitLength.Enabled = True

    'Fira Attack
    ElseIf bolFira = True Then
    intAttack = FiraAttack
    intWhosMove = intWhosMove + 1
    lblEnemy1Hit.Visible = True
    lblEnemy1Hit.Caption = intAttack
    intEnemy1HP = intEnemy1HP - intAttack
    bolFira = False
    lblEnemy1HP = intEnemy1HP & "\" & intEnTotal
    fraMagic.Visible = False
    picFire.Visible = True

    If intEnemy1HP <= 0 Then
    picEnemy1.Visible = False
    lblEnemy1HP.Visible = False
    lblHelp.Caption = "You win!"
    Call ButtonsDisable
    Else
    If intWhosMove > 4 Then
    intWhosMove = 1
    End If

    If intWhosMove = 1 Then
    Call CloudsMove
    ElseIf intWhosMove = 2 Then
    picCloud.Move picCloud.Left - 350
    intCloudMP = intCloudMP - 35
    lblCloudMP.Caption = intCloudMP & "\150"
    Call TifasMove
    ElseIf intWhosMove = 3 Then
    picTifa.Move picTifa.Left - 350
    intTifaMP = intTifaMP - 35
    lblTifaMP.Caption = intTifaMP & "\184"
    Call BarretsMove
    ElseIf intWhosMove = 4 Then
    picBarret.Move picBarret.Left - 350
    intBarretMP = intBarretMP - 35
    lblBarretMP.Caption = intBarretMP & "\95"
    Call Enemy1Move
    End If
    End If

    tmrHitLength.Enabled = True

    'Thunder Attack
    ElseIf bolThunder = True Then
    intAttack = ThunderAttack
    intWhosMove = intWhosMove + 1
    lblEnemy1Hit.Visible = True
    lblEnemy1Hit.Caption = intAttack
    intEnemy1HP = intEnemy1HP - intAttack
    bolThunder = False
    lblEnemy1HP = intEnemy1HP & "\" & intEnTotal
    fraMagic.Visible = False
    picThunder.Visible = True

    If intEnemy1HP <= 0 Then
    picEnemy1.Visible = False
    lblEnemy1HP.Visible = False
    lblHelp.Caption = "You win!"
    Call ButtonsDisable
    Else
    If intWhosMove > 4 Then
    intWhosMove = 1
    End If

    If intWhosMove = 1 Then
    Call CloudsMove
    ElseIf intWhosMove = 2 Then
    picCloud.Move picCloud.Left - 350
    intCloudMP = intCloudMP - 25
    lblCloudMP.Caption = intCloudMP & "\150"
    Call TifasMove
    ElseIf intWhosMove = 3 Then
    picTifa.Move picTifa.Left - 350
    intTifaMP = intTifaMP - 25
    lblTifaMP.Caption = intTifaMP & "\184"
    Call BarretsMove
    ElseIf intWhosMove = 4 Then
    picBarret.Move picBarret.Left - 350
    intBarretMP = intBarretMP - 25
    lblBarretMP.Caption = intBarretMP & "\95"
    Call Enemy1Move
    End If
    End If

    tmrHitLength.Enabled = True

    'Blizzard Attack
    ElseIf bolBlizzard = True Then
    intAttack = BlizzardAttack
    intWhosMove = intWhosMove + 1
    lblEnemy1Hit.Visible = True
    lblEnemy1Hit.Caption = intAttack
    intEnemy1HP = intEnemy1HP - intAttack
    bolBlizzard = False
    lblEnemy1HP = intEnemy1HP & "\" & intEnTotal
    fraMagic.Visible = False
    picBlizzard.Visible = True

    If intEnemy1HP <= 0 Then
    picEnemy1.Visible = False
    lblEnemy1HP.Visible = False
    lblHelp.Caption = "You win!"
    Call ButtonsDisable
    Else
    If intWhosMove > 4 Then
    intWhosMove = 1
    End If

    If intWhosMove = 1 Then
    Call CloudsMove
    ElseIf intWhosMove = 2 Then
    picCloud.Move picCloud.Left - 350
    intCloudMP = intCloudMP - 25
    lblCloudMP.Caption = intCloudMP & "\150"
    Call TifasMove
    ElseIf intWhosMove = 3 Then
    picTifa.Move picTifa.Left - 350
    intTifaMP = intTifaMP - 25
    lblTifaMP.Caption = intTifaMP & "\184"
    Call BarretsMove
    ElseIf intWhosMove = 4 Then
    picBarret.Move picBarret.Left - 350
    intBarretMP = intBarretMP - 25
    lblBarretMP.Caption = intBarretMP & "\95"
    Call Enemy1Move
    End If
    End If

    tmrHitLength.Enabled = True
    End If
    End Sub

    Function BlizzardAttack() As Integer
    'Generates how much blizzard damages
    Randomize
    BlizzardAttack = Rnd * 400 + 350
    End Function

    Function ThunderAttack() As Integer
    'Generates how much thunder damages
    Randomize
    ThunderAttack = Rnd * 420 + 220
    End Function

    Function FiraAttack() As Integer
    'Generates how much fira damages
    Randomize
    FiraAttack = Rnd * 620 + 200
    End Function

    Function FireAttack() As Integer
    'Generates how much fire damages
    Randomize
    FireAttack = Rnd * 375 + 100
    End Function

    Sub ButtonsEnable()
    'Reenables buttons
    cmdAttack.Enabled = True
    cmdMagic.Enabled = True
    cmdItem.Enabled = True
    End Sub

    Sub ButtonsDisable()
    'Disables all buttons
    cmdAttack.Enabled = False
    cmdMagic.Enabled = False
    cmdItem.Enabled = False
    fraMagic.Visible = False
    fraItems.Visible = False
    End Sub

    Sub Enemy1Move()
    Dim intHitWho As Integer
    Dim intAttack As Integer

    Call ButtonsDisable
    lblHelp.Caption = "Enemy " & intCounter & "'s Move"
    Randomize
    intHitWho = Rnd * 2 + 1

    intAttack = Rnd * 300 + 100

    If intHitWho = 1 Then 'If 1 Start

    If bolCloudKO = True Then
    lblCloudHit.Caption = "Miss"

    ElseIf intAttack > intCloudHP Then 'If 2 Start
    bolCloudKO = True
    lblCloudHP.Caption = "0\1000"
    lblCloudHit.Visible = True
    picCloudKO.Visible = True
    lblCloudHit.Caption = intAttack

    If AllDead = True Then 'If 3 Start
    MsgBox "You lose. Game over."
    Call ButtonsDisable
    strHelp = "Game over. " & intCounter & " enemies defeated."
    lblHelp.Caption = strHelp
    End If 'If 3 End

    Else
    intCloudHP = intCloudHP - intAttack
    lblCloudHP.Caption = intCloudHP & "\1000"
    lblCloudHit.Visible = True
    lblCloudHit.Caption = intAttack
    End If 'If 2 End

    ElseIf intHitWho = 2 Then

    If bolTifaKO = True Then
    lblTifaHit.Caption = "Miss"

    ElseIf intAttack > intTifaHP Then 'If 4 Start
    bolTifaKO = True
    lblTifaHP.Caption = "0\1000"
    lblTifaHit.Visible = True
    picTifaKO.Visible = True
    lblTifaHit.Caption = intAttack

    If AllDead = True Then 'If 5 start
    MsgBox "You lose. Game over."
    Call ButtonsDisable
    strHelp = "Game over. " & intCounter & " enemies defeated."
    lblHelp.Caption = strHelp
    End If 'if 5 end

    Else
    intTifaHP = intTifaHP - intAttack
    lblTifaHP.Caption = intTifaHP & "\1000"
    lblTifaHit.Visible = True
    lblTifaHit.Caption = intAttack
    End If 'If 4 End

    ElseIf intHitWho = 3 Then

    If bolBarretKO = True Then
    lblBarretHit.Caption = "Miss"

    ElseIf intAttack > intBarretHP Then 'If 6 Start
    bolBarretKO = True
    lblBarretHP.Caption = "0\1000"
    lblBarretHit.Visible = True
    picBarretKO.Visible = True
    lblBarretHit.Caption = intAttack

    If AllDead = True Then 'if 7 start
    MsgBox "You lose. Game over."
    Call ButtonsDisable
    strHelp = "Game over. " & intCounter & " enemies defeated."
    lblHelp.Caption = strHelp
    End If 'if 7 end

    Else
    intBarretHP = intBarretHP - intAttack
    lblBarretHP.Caption = intBarretHP & "\1000"
    lblBarretHit.Visible = True
    lblBarretHit.Caption = intAttack
    End If 'if 6 end

    End If 'if 1 end

    tmrCharHitLength.Enabled = True
    tmrEnemy1Turn.Enabled = True
    End Sub

    Function AllDead() As Boolean
    'True if all chars are KO
    If bolCloudKO = True And bolTifaKO = True And bolBarretKO = True Then
    AllDead = True
    Else
    AllDead = False
    End If
    End Function

    Sub BarretsMove()
    'Checks if Barret is Dead
    If bolBarretKO = True Then
    Call Enemy1Move
    Else
    intWhosMove = 3
    Call ButtonsEnable
    picBarret.Move picBarret.Left + 350
    lblHelp.Caption = "Barrets's Move"
    End If
    End Sub

    Sub CloudsMove()
    'Checks if Cloud is dead
    If bolCloudKO = True Then
    Call TifasMove
    Else
    intWhosMove = 1
    picCloud.Move picCloud.Left + 350
    Call ButtonsEnable
    lblHelp.Caption = "Cloud's Move"
    End If
    End Sub

    Sub TifasMove()
    'Checks if Tifa is dead
    If bolTifaKO = True Then
    Call BarretsMove
    Else
    intWhosMove = 2
    picTifa.Move picTifa.Left + 350
    Call ButtonsEnable
    lblHelp.Caption = "Tifa's Move"
    End If
    End Sub

    Private Sub Form_Load()
    'Sets Everyone's HP and MP
    intCloudHP = 1000
    intCloudMP = 150
    intTifaHP = 945
    intTifaMP = 184
    intBarretHP = 1140
    intBarretMP = 95
    intEnemy1HP = 7805
    'how many items
    intPotion = 5
    intDown = 2
    intEther = 3
    'The current enemy's total HP
    intEnTotal = 7805
    'How many enemies faced
    intCounter = 1
    'Cloud always goes first
    Call CloudsMove
    End Sub

    Private Sub picTifa_Click()
    'Use a potion - Increase HP by 250
    If bolPotion = True Then
    bolPotion = False
    intTifaHP = intTifaHP + 250

    If intTifaHP > 945 Then
    intTifaHP = 945
    End If

    lblTifaHP.Caption = intTifaHP & "\945"
    intPotion = intPotion - 1
    cmdPotion.Caption = "Potion - " & intPotion
    intWhosMove = intWhosMove + 1
    lblTifaHit.Caption = "250"
    tmrCharHitLength.Enabled = True

    If intWhosMove > 4 Then
    intWhosMove = 1
    End If

    If intWhosMove = 1 Then
    Call CloudsMove
    ElseIf intWhosMove = 2 Then
    picCloud.Move picCloud.Left - 350
    Call TifasMove
    ElseIf intWhosMove = 3 Then
    picTifa.Move picTifa.Left - 350
    Call BarretsMove
    ElseIf intWhosMove = 4 Then
    picBarret.Move picBarret.Left - 350
    Call Enemy1Move
    End If

    'Use an ether - increase MP by 40MP
    ElseIf bolEther = True Then
    intTifaMP = intTifaMP + 40

    If intTifaMP > 184 Then
    intTifaMP = 184
    End If

    bolEther = False
    lblTifaMP.Caption = intTifaMP & "\184"
    intEther = intEther - 1
    cmdEther.Caption = "Ether - " & intEther
    intWhosMove = intWhosMove + 1
    lblTifaHit.Caption = "40MP"
    tmrCharHitLength.Enabled = True

    If intWhosMove > 4 Then
    intWhosMove = 1
    End If

    If intWhosMove = 1 Then
    Call CloudsMove
    ElseIf intWhosMove = 2 Then
    picCloud.Move picCloud.Left - 350
    Call TifasMove
    ElseIf intWhosMove = 3 Then
    picTifa.Move picTifa.Left - 350
    Call BarretsMove
    ElseIf intWhosMove = 4 Then
    picBarret.Move picBarret.Left - 350
    Call Enemy1Move
    End If
    End If
    End Sub

    Private Sub picTifaKO_Click()
    'restore KO'd char to 300HP
    If bolDown = True Then
    bolTifaKO = False
    bolDown = False
    intTifaHP = 300
    lblTifaHP.Caption = "300\1000"
    intDown = intDown - 1
    cmdDown.Caption = "Pheonix Down - " & intDown
    intWhosMove = intWhosMove + 1
    lblTifaHit.Caption = "300"
    tmrCharHitLength.Enabled = True
    picTifaKO.Visible = False

    If intWhosMove > 4 Then
    intWhosMove = 1
    End If

    If intWhosMove = 1 Then
    Call CloudsMove
    ElseIf intWhosMove = 2 Then
    picCloud.Move picCloud.Left - 350
    Call TifasMove
    ElseIf intWhosMove = 3 Then
    picTifa.Move picTifa.Left - 350
    Call BarretsMove
    ElseIf intWhosMove = 4 Then
    picBarret.Move picBarret.Left - 350
    Call Enemy1Move
    End If
    End If
    End Sub

    Private Sub tmrCharHitLength_Timer()
    'How long the hit status remains on
    lblCloudHit.Caption = ""
    lblTifaHit.Caption = ""
    lblBarretHit.Caption = ""
    tmrCharHitLength.Enabled = False
    End Sub

    Private Sub tmrEnemy1Turn_Timer()
    'Only continue if someone is alive
    If AllDead = False Then
    intWhosMove = 1
    Call CloudsMove
    tmrEnemy1Turn.Enabled = False
    End If
    End Sub

    Private Sub tmrHitLength_Timer()
    'Length of enemy staus
    picFire.Visible = False
    picBlizzard.Visible = False
    picThunder.Visible = False
    lblEnemy1Hit.Visible = False
    tmrHitLength.Enabled = False
    End Sub
     
sonicdude10
Draft saved Draft deleted
Insert every image as a...
  1.  0%

Share This Page