-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bubble.java
44 lines (35 loc) · 994 Bytes
/
Bubble.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
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.paint.Color;
import java.util.Random;
public class Bubble extends Entity{
protected double vy;
protected double rayon;
//Construit les bulles
public Bubble(double baseX, double yi){
Random random;
this.x = baseX;
this.y = -yi;
this.rayon = Math.random()*41+10;
this.vy = -(Math.random()*451+350);
this.vx = 0;
this.couleur = Color.rgb(0,0,255,.4);
}
public double getX(){
return this.x;
}
public double getY(){
return this.y;
}
public double getVitesseY(){
return this.vy;
}
public void update(double dt) {
y += dt*vy;
}
@Override
public void draw(GraphicsContext context, double fenetreY) {
double yAffiche = y - fenetreY;
context.setFill(couleur);
context.fillOval(x-rayon,y-rayon,rayon,rayon);
}
}