-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCharacterPlayState.java
43 lines (38 loc) · 1.23 KB
/
CharacterPlayState.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
33
34
35
36
37
38
39
40
41
42
43
/**
* This code allows you to represent a character to be used in a simple game.
*/
public class CharacterPlayState extends Character {
/* variables to describe the character */
private String name;
private String description;
private int secretWeapon;
private int health =10;
/*Constructor method*/
public Character(String otherName, String otherDescription,
int otherHealth, int otherSecretWeapon){
name = otherName;
description = otherDescription;
health = otherHealth;
secretWeapon = otherSecretWeapon;
}
/*Accessors and mutators*/
public void setName(String n) {name = n;}
public String getName(){return name;}
// to do method setDescription
// to do method getDescription
// to do method setSecretWeapon
// to do method getSecretWeapon
/*Other methods*/
// todo: create public void resetHealth(){//your code here;}
/*Other methods*/
public void printInfo(){
String result =
"*************************************"+ "\n" +
"Name: " + name + "\n" +
"Description: " + description + "\n" +
"Secret weapon: " + secretWeapon + "\n" +
"Health: " + health + "\n" +
"*************************************";
System.out.println(result);
}
}