-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBubble.java
More file actions
45 lines (37 loc) · 925 Bytes
/
Bubble.java
File metadata and controls
45 lines (37 loc) · 925 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
38
39
40
41
42
43
44
45
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.paint.Color;
public class Bubble
{
private double x;
private double y;
private double d;
private double speed;
private int green,red;
public Bubble(){
x = 200;
y = 360;
d = 5;
speed = 6;
green =(int)(Math.random()*255);
red =(int)(Math.random()*100);
}
public void zeichnen(GraphicsContext gc){
gc.setFill(Color.rgb(200, green, 0, y/400));
gc.fillOval(x,y,d,Math.random()*20);
}
public void bewegen()
{
x += Math.random()*2-1;
y -= Math.random()*speed-2;
}
public int getY(){
return (int)y;
}
public void setSpeed(int speed){
this.speed = speed;
}
public void setSize(int size){
System.out.println("isdlufghliksghfl");
d = size;
}
}