I'm making a simple text based adventure in VB.net console that includes combat. In the fight scenes I want the game to generate a random number that determines how much damage you. This is my current code:
Module Module1
Dim rng As New Random
Dim strmod As Integer = 1
Dim yourhit As Integer
Sub Main()
Console.WriteLine("Welocome to the training grounds!")
yourhit = (rng.Next(1, 4) + strmod)
Console.WriteLine("You hit the dummy and deal {0} damage to it!",
yourhit)
End Sub
End Module
Now i'm wondering if its possible for my randomly generated number to be displayed without it being entered into another variable (in this case the yourhit variable). I've tried simply by having rng instead of yourhit but that a message saying You hit the dummy and deal System.Random damage to it!
I'm new to visual basic so any help would be appreciated!
Aucun commentaire:
Enregistrer un commentaire