-
Notifications
You must be signed in to change notification settings - Fork 1
/
PointPellet.java
46 lines (34 loc) · 1.25 KB
/
PointPellet.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
44
45
46
/* PointPellet.java
* Matthew Pechen-Berg and Peter Jang
* January 17th, 2020
* Class that reward Players with points for collecting pellets
*/
public class PointPellet extends SpawnedPowerup {
//Declare private variables
private int pointReward;
private int pelletSize;
//Constructor for the PointPellet class
PointPellet(int row, int col, int pelletSize) {
super(row, col, pelletSize);
//Required for constructor
this.pelletSize = pelletSize;
this.createPointReward();
}//end of PointPellet Constructor
/** Creates point rewards for the different pellets
*/
private void createPointReward() {
//if pellet is large, point reward = 25 points
if (pelletSize == 1) {
this.pointReward = 25;
//else point reward = 10 points
} else {
this.pointReward = 10;
}//end if structure for determining reward amount
}//end of createPointReward()
/** Gives Player the powerup which increases Players score
*@param playerGatherer Player who got powerup
*/
public void getPowerup(Player playerGatherer) {
playerGatherer.increaseScore(this.pointReward);
}//end of getPowerup()
}//end of PointPellet class