-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProjectile.java
More file actions
50 lines (28 loc) · 1.04 KB
/
Copy pathProjectile.java
File metadata and controls
50 lines (28 loc) · 1.04 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
public class Projectile extends Entity implements Scrollable {
public static final String PROJ_IMAGE_FILE = "game_assets/Lazer.gif";
public static final int PROJ_WIDTH = 35;
public static final int PROJ_HEIGHT = 15;
public static final int PROJ_DEFAULT_SCROLL_SPEED = 4;
private int scrollSpeed = PROJ_DEFAULT_SCROLL_SPEED;
public static int overScrollSpeed = PROJ_DEFAULT_SCROLL_SPEED;
public Projectile(){
this(0, 0);
}
public Projectile(int x, int y){
super(x, y, PROJ_WIDTH, PROJ_HEIGHT, PROJ_IMAGE_FILE);
}
public int getScrollSpeed(){
return this.scrollSpeed;
}
//Sets the scroll speed to the argument amount
public void setScrollSpeed(int newSpeed){
this.scrollSpeed = newSpeed;
}
public static void setOverScrollSpeed(int newSpeed){
overScrollSpeed = newSpeed;
}
//Move the scrollable by its respective scroll speed
public void scroll(){
setX(getX() + overScrollSpeed);
}
}