Fight Simulator on Visual Basic 2010 made by Tansvanio

Users who are viewing this thread

tansvanio

Sergeant Knight at Arms
Hey there folks! I am currently having a introduction to programming class in my school and we were all assigned to make a program using the skills we learned. While everyone is making calculators and "Hello World" programs I decided to make a fight simulator sorta game. I am still very fresh on this program business but I would like you guys to give me opinions and suggestions before I present it to my teacher.


I guarantee you there is no virus to you worry folks :wink:




Here is the linkie --> http://www.mediafire.com/?9ccsg7okrbgrp56


How to play: Give the name of your 2 fighters to the program and click on the "Fight" button until you get the "Finnisher" option to kill your oponent.


Any suggestion is important to me, so please do :wink:


Thanks,


Tansvanio
 
Tried it, it said Tim introduces his finger into Tim's *****'s eye! Tim's ***** is half blind.
Then it said the same thing again, Tim's ***** was fully blind I guess.
After a while it happened again, and again, and again...
 
Wierd. Well, the program generates a random number from (1 to 20) x 20 times. Each combat movement is associated with a number. Its wierd that the same number got repeated that much. Maybe I can add something that eliminates one number after it has been selected by the randomness.
 
tansvanio said:
Wierd. Well, the program generates a random number from (1 to 20) x 20 times. Each combat movement is associated with a number. Its wierd that the same number got repeated that much. Maybe I can add something that eliminates one number after it has been selected by the randomness.

Unless you reinitialize the random number generator it will only come up with a random number once and repeatedly give that value.
 
Splintert said:
tansvanio said:
Wierd. Well, the program generates a random number from (1 to 20) x 20 times. Each combat movement is associated with a number. Its wierd that the same number got repeated that much. Maybe I can add something that eliminates one number after it has been selected by the randomness.

Unless you reinitialize the random number generator it will only come up with a random number once and repeatedly give that value.


I know. Everytime you press the button the genetor is reinitialized.
 
I am not sure I even used a seed. I am quite new at these things. Here is the code I used.



Public Class Form1
    Dim Fighter1 As String
    Dim Fighter2 As String
    Dim Num1 As Single
    Public Class GlobalVariable
        Public Shared intVariable As Integer
    End Class






    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Close()
    End Sub


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Fighter1 = CObj(TextBox1.Text)
        Fighter2 = CObj(TextBox2.Text)


Simulation_Start:
        If GlobalVariable.intVariable <= 19 Then
            'Add one to the intVariable
            GlobalVariable.intVariable = GlobalVariable.intVariable + 1
            'Do the common action
            Dim x As Integer
            Dim Num1 As Integer
            Randomize()


            For x = 1 To 20
                Num1 = Rnd() * 20


                If Num1 = 1 Then
                    RichTextBox1.Text = Fighter1 + " kicks " + Fighter2 + " in the stomach!"


                ElseIf Num1 = 2 Then
                    RichTextBox1.Text = Fighter2 + " kicks " + Fighter1 + " in the stomach!"


                ElseIf Num1 = 3 Then
                    RichTextBox1.Text = Fighter1 + " punches " + Fighter2 + " in his jaw!"


                ElseIf Num1 = 4 Then
                    RichTextBox1.Text = Fighter2 + " punches " + Fighter1 + " in his jaw!"


                ElseIf Num1 = 5 Then
                    RichTextBox1.Text = Fighter1 + " hits " + Fighter2 + " with a flying kick!"


                ElseIf Num1 = 6 Then
                    RichTextBox1.Text = Fighter2 + " hits " + Fighter1 + " with a flying kick!"


                ElseIf Num1 = 7 Then
                    RichTextBox1.Text = Fighter1 + " introduces his finger into " + Fighter2 + "´s eye! " + Fighter2 + " is half blind."


                ElseIf Num1 = 8 Then
                    RichTextBox1.Text = Fighter2 + " introduces his finger into " + Fighter1 + "´s eye! " + Fighter1 + " is half blind."


                ElseIf Num1 = 9 Then
                    RichTextBox1.Text = Fighter1 + " throws " + Fighter2 + " to the ground!"


                ElseIf Num1 = 10 Then
                    RichTextBox1.Text = Fighter2 + " throws " + Fighter1 + " to the ground!"


                ElseIf Num1 = 11 Then
                    RichTextBox1.Text = Fighter1 + " breaks " + Fighter2 + "´s nose! " + Fighter2 + " is bleeding!"


                ElseIf Num1 = 12 Then
                    RichTextBox1.Text = Fighter2 + " breaks " + Fighter1 + "´s nose! " + Fighter1 + " is bleeding!"


                ElseIf Num1 = 13 Then
                    RichTextBox1.Text = Fighter1 + " breaks " + Fighter2 + "´s arm!"


                ElseIf Num1 = 14 Then
                    RichTextBox1.Text = Fighter2 + " breaks " + Fighter1 + "´s arm!"


                ElseIf Num1 = 15 Then
                    RichTextBox1.Text = Fighter1 + " tries to choke " + Fighter2 + "!"


                ElseIf Num1 = 16 Then
                    RichTextBox1.Text = Fighter2 + " tries to choke " + Fighter1 + "!"


                ElseIf Num1 = 17 Then
                    RichTextBox1.Text = Fighter1 + " bites off " + Fighter2 + "´s ear!"


                ElseIf Num1 = 18 Then
                    RichTextBox1.Text = Fighter2 + " bites off " + Fighter1 + "´s ear!"


                End If




            Next


            If GlobalVariable.intVariable = 20 Then
                Button1.Text = "Finish him!"


                If Num1 = 19 Then
                    RichTextBox1.Text = Fighter1 + " punches " + Fighter2 + " in his balls! Ouch!"


                ElseIf Num1 = 20 Then
                    RichTextBox1.Text = Fighter2 + " punches " + Fighter1 + " in his balls! Ouch!"


                End If
            End If




            Else


                'Do the alternate action


                Dim x As Integer
                Dim Num1 As Integer
                Randomize()


                For x = 1 To 2
                    Num1 = Rnd() * 2


                If Num1 = 1 Then
                    RichTextBox1.Text = Fighter1 + " lands a punch so hard in " + Fighter2 + "´s head that he decapitates him!"
                    RichTextBox2.Text = Fighter1 + " wins!"
                    GoTo Simulation_Start


                ElseIf Num1 = 2 Then
                    RichTextBox1.Text = Fighter2 + " lands a punch so hard in " + Fighter1 + "´s head that he decapitates him!"
                    RichTextBox2.Text = Fighter2 + " wins!"
                    GoTo Simulation_Start


                End If


                Next
            End If
    End Sub




    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


        'initalize the variable
        GlobalVariable.intVariable = 1


    End SubEnd Class
 
Back
Top Bottom