Repository navigation
Expand file tree
/
Copy pathItem.java
More file actions
67 lines (63 loc) · 1.52 KB
/
Copy pathItem.java
File metadata and controls
67 lines (63 loc) · 1.52 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
* CS 141: Intro to Programming and Problem Solving
* Professor: Edwin Rodríguez
*
* Programming Assignment #N
*
* <description-of-assignment>
* This is a team project in which we implement a 2D game containing
* various objects: rooms, power ups, player, and ninjas.
* The goal of this game is to have the user interact with different
* entities in the program and to complete the objective of finding
* the briefcase.
*
* Team Blank
*
* Justen Minamitani
* Saroj Poudel
* Steve Marrero
* Aaron Lim
* Koshi Huynh
* Jon Camarillo
*/
package edu.cpp.cs.cs141.final_prog_assignment;
import java.io.Serializable;
/**
* This class represents the items that are available to the player
* Radar, Ammo, and Invincible. They will have a string representation
* of the type of item and will be placed randomly on the board.
*/
public class Item implements Serializable{
private String type;
/**
* This method will set the type of item.
* @param s type of item
*/
public Item(String s) {
type = s;
}
/**
* This method will return the String representation of the item
* depending on the type
* @return " A" for ammo, " R " for radar, and " I " for invincible
*/
public String getType() {
switch(type) {
case "radar":
return " R ";
case "invincible":
return " I ";
case "ammo":
return " A ";
default:
return "Error - PowerUp.display - Switch";
}
}
/**
* This method will return the type of item
* @return item type
*/
public String name() {
return type;
}
}