-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObstacle.java
More file actions
80 lines (71 loc) · 1.9 KB
/
Obstacle.java
File metadata and controls
80 lines (71 loc) · 1.9 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
68
69
70
71
72
73
74
75
76
77
78
79
80
import java.awt.*;
import java.util.*;
/**
* Obstacle class sets parameters for the objects on the battlefield
*Simple methods for accessing and setting the x, y, width and height values for obstacles to be used in the game
*/
public class Obstacle{
private static final long serialVersionUID = 5L;
private int x = 0;
private int y = 0;
private int width;
private int height;
// public Vector<Dude> dudes = new Vector<>();
// public Vector<Bullet> bulls = new Vector<>();
/**
*Constructs obstacle at given xy value
*
*@param x1 - x position of the created object
*@param y1 - y position of the created object
*/
public Obstacle(int x1, int y1){
x = x1;
y = y1;
}
/**
* Accessor method for the x position of the obstacle, Used for collision and computing width
* @return x the x value of the obstacle
*/
public int getObsX(){
return x;
}
/**
*Accessor method for the x position of the obstacle, Used for collision and computing height
*@return y the y value of the obstacle
*/
public int getObsY(){
return y;
}
/**
* sets width of obstacle to be passed to battlefield class
*
*@param value the width to be set
*/
public void setWidth(int value){
width = value;
}
/**
* sets height of obstacle to be passed to the battlefield class
*
* @param value the height to be set
*/
public void setHeight(int value){
height = value;
}
/**
* Accessor the width of the obstacle
*
* @return the width of the obstacle
*/
public int getWidth(){
return width;
}
/**
* Accessor the height of the obstacle
*
* @return the height of the obstacle
*/
public int getHeight(){
return height;
}
}//end obstacles