-
Notifications
You must be signed in to change notification settings - Fork 0
/
PowerUpModel.java
41 lines (35 loc) · 963 Bytes
/
PowerUpModel.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
package com.Carlos.spaceinvaders.model.models;
public class PowerUpModel extends Elements {
public enum PowerUpType{
HealthBoost,
ScoreBoost,
FireRateBoost
}
private final int speed;
private int active;
private PowerUpType powerUpType;
public PowerUpModel(PositionModel position, int speed, PowerUpType powerUpType){
super(position);
this.speed = speed;
this.active = 0;
this.powerUpType = powerUpType;
}
public PowerUpType getPowerUpType() {
return powerUpType;
}
public int getSpeed(){
return speed;
}
public void incrementActive() {
this.active = (this.active + 1) % 3;
}
public int isActive() {
return active;
}
public void move(){
getPosition().setY(getPosition().getY() + speed);
}
public void setPowerUpType(PowerUpType powerUpType) {
this.powerUpType = powerUpType;
}
}