-
Notifications
You must be signed in to change notification settings - Fork 0
/
Point.java
81 lines (76 loc) · 1.67 KB
/
Point.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
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
81
package endlessrunningtcf;
public class Point{
private int x;
private int y;
private char c=' ';
private Boolean ischarcter;
private Boolean isobstacle;
public Point(int x_, int y_){
x = x_;
y = y_;
ischarcter = false;
isobstacle = false;
}
public Point(int x_, int y_, Boolean ischaracter_, Boolean isobstacle_){
x = x_;
y = y_;
ischarcter = ischaracter_;
isobstacle = isobstacle_;
if(ischarcter==true){ //in funzione del valore delle booleane setta il char
setChar('@');
}
if(isobstacle==true){
setChar('#');
}
}
public void setX(int x_){
x = x_;
}
public void setY(int y_){
y = y_;
}
public int getX(){
return x;
}
public int getY(){
return y;
}
public void setChar(char c_){
c = c_;
}
public char getChar(){
return c;
}
public void setCharacter(Boolean tf){
ischarcter = tf;
if(ischarcter==true){
setChar('@');
}
if(ischarcter==false){
setChar(' ');
}
}
public void setObstacle(Boolean tf){
isobstacle = tf;
if(isobstacle==true){
setChar('#');
}
if(isobstacle==false){
setChar(' ');
}
}
public Boolean isCharacter(){
return ischarcter;
}
public Boolean isObstacle(){
return isobstacle;
}
public Boolean checkCollision(){
if(ischarcter == true && isobstacle == true){
return true;
}
else{
return false;
}
}
}