-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnemy.java
More file actions
37 lines (24 loc) · 811 Bytes
/
Copy pathEnemy.java
File metadata and controls
37 lines (24 loc) · 811 Bytes
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
public class Enemy extends Avoid {
public static final String ENEMY_IMAGE_FILE = "game_assets/Enemy.gif";
public static final int ENEMY_DEFAULT_SCROLL_SPEED = 1;
private static int uniScrollSpeed = ENEMY_DEFAULT_SCROLL_SPEED;
public Enemy(){
this(0, 0);
}
public Enemy(int x, int y){
super(x, y, AVOID_WIDTH, AVOID_HEIGHT, ENEMY_IMAGE_FILE);
}
public Enemy(int x, int y,int width, int height, String image){
super(x, y, width, height, image);
}
public static int getUnivScrollSpeed(){
return uniScrollSpeed;
}
public static void setUnivScrollSpeed(int newSpeed){
uniScrollSpeed = newSpeed;
}
@Override
public void scroll(){
setX(getX() - uniScrollSpeed);
}
}