-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCharacter.java
32 lines (29 loc) · 927 Bytes
/
Character.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import java.lang.Main;
/**
* Main class of the Java program.
* This code allows you to represent a character to be used in a simple game.
*/
public class Character extends UnityPlayerActivity {
/* variables to describe the character */
String name;
//to do: create a new String variable description
int health;
int secretWeapon;
/*Constructor method*/
public Character(String otherName, int otherHealth, int otherSecretWeapon){
name = otherName;
health = otherHealth;
secretWeapon = otherSecretWeapon;
}
/*Other methods*/
public void printInfo(){
String result =
"*************************************"+ "\n" +
"Name: " + name + "\n" +
//to do: include your code for printing the description
"Secret weapon: " + secretWeapon + "\n" +
"Health: " + health + "\n" +
"*************************************";
System.out.println(result);
}
}