We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 7f01de9 + baa45eb commit 30f1d18Copy full SHA for 30f1d18
bird.js
@@ -7,9 +7,12 @@ class Bird {
7
constructor() {
8
this.y = height/2;
9
this.x = 64;
10
+ this.size = 32;
11
+
12
this.gravity = 0.6;
13
this.lift = -15;
14
this.velocity = 0;
15
16
this.icon = loadImage("graphics/train.png");
17
this.width = 64;
18
this.height = 64;
@@ -29,13 +32,13 @@ class Bird {
29
32
this.velocity *= 0.9;
30
33
this.y += this.velocity;
31
34
- if (this.y >= height) {
- this.y = height;
35
+ if (this.y >= height - this.size/2) {
36
+ this.y = height - this.size/2;
37
38
}
39
- if (this.y < 0) {
- this.y = 0;
40
+ if (this.y <= this.size/2) {
41
+ this.y = this.size/2;
42
43
44
0 commit comments