I've just started to learn Java, and I'm pretty new.
I am trying to create a very simple text based RPG game in Java.
I have created a class called "enemy". This class contains certain variables, such as a string for the enemy's name, integers for the enemy's health, damage, and so on. With this "enemy" class, I create specific enemies. For example, using the "enemy" class, I'll make a zombie enemy and assign certain values to the above mentioned variables.
What I would like to be able to do is to have a random enemy encounter. For example, lets say I have a zombie enemy, giant spider enemy, and an assassin enemy, each with values assigned to variables within the "enemy" class, I would like to have a random battle encounter. The zombie appear maybe 45% of the time, the spider 25% of the time, and the assassin, 30% of the time.
How can I do this or something similar? Any tutorials maybe?
Sorry if I'm not making much sense...
Aucun commentaire:
Enregistrer un commentaire