Hi all,
I'm new to
Java, learning it for my Computing course at university.
For a project over Easter I must make a simple game on the concept of rock, paper, scissors.
Note the game is nothing graphical yet, just command line stuff.
The first activity is to create a class to make the base units. (This game is using land, sea and air instead of rock, paper and scissors.)
I have done this, however I need methods to make the units attack each other.
I need two methods, one to attack, and another to calculate the damage. The attack method is called and uses the damage method to deal damage to the other
unit.
How can I instruct the attack method to use the damage method?
Here is my code:
and the main method to test this:
The attack and damage methods are currently incomplete. If I comment them out and run the program, it returns this result:
Base Unit (100/100)
Gary (75/100) false
So how can I code this problem? I remember one of my classmates working on it, and having something like
Is this on the right lines?
I hope you can help me.
Thanks in advance.