-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCircle.java
71 lines (64 loc) · 1.54 KB
/
Circle.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
package com.example.manju.shapes;
public class Circle {
private int centerX;
private int centerY;
private int radius;
private int delta =5;
public Circle(int centerX, int centerY, int radius) {
this.centerX = centerX;
this.centerY = centerY;
this.radius = radius;
}
public void moveEast(){
/*if(centerX==0){
centerX = screenX;
}*/if(centerX <=1800) {
centerX = centerX + delta;
}else{
centerX = 0;
centerX = centerX + delta;
}
}
public void moveWest(){
/*if(centerX==0){
centerX = screenX;
}*/
if(centerX>0) {
centerX = centerX - 10;
}else{
centerX = 1800;
centerX = centerX - 10;
}
}
public void moveNorth(){
/*if(centerX==0){
centerX = screenX;
}*/
if(centerY>0) {
centerY = centerY - 10;
}else{
centerY = 1000;
centerY = centerY - 10;
}
}
public void moveSouth(){
/*if(centerX==0){
centerX = screenX;
}*/
if(centerY<=1000) {
centerY = centerY + 15;
}else{
centerY = 0;
centerY = centerY + 15;
}
}
public int getCenterX(){
return centerX;
}
public int getCenterY(){
return centerY;
}
public int getRadius(){
return radius;
}
}