Skip to content

Commit e8859db

Browse files
author
Thomas
committed
better comments
1 parent 5d81c4d commit e8859db

2 files changed

Lines changed: 13 additions & 11 deletions

File tree

35 Bytes
Binary file not shown.

3-flappy_bird/flappy_bird_final/main.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ game_state.main.prototype = {
3939
if (this.bird.inWorld == false)
4040
this.restart_game();
4141

42+
// Make the bird slowly rotate downward
4243
if (this.bird.angle < 20)
4344
this.bird.angle += 1;
4445

@@ -52,25 +53,26 @@ game_state.main.prototype = {
5253

5354
this.bird.body.velocity.y = -350;
5455

55-
// Rotate the bird
56+
// Animation to rotate the bird
5657
this.game.add.tween(this.bird).to({angle: -20}, 100).start();
5758

5859
// Play a jump sound
5960
this.jump_sound.play();
6061
},
6162

62-
hit_pipe: function() {
63-
// Set the alive flag to false
64-
this.bird.alive = false;
63+
// Dead animation when the bird hit a pipe
64+
hit_pipe: function() {
65+
// Set the alive flag to false
66+
this.bird.alive = false;
6567

66-
// Prevent new pipes from apearing
67-
this.game.time.events.remove(this.timer);
68+
// Prevent new pipes from apearing
69+
this.game.time.events.remove(this.timer);
6870

69-
// Go trough all the pipes, and stop their movement
70-
this.pipes.forEachAlive(function(p){
71-
p.body.velocity.x = 0;
72-
}, this);
73-
},
71+
// Go trough all the pipes, and stop their movement
72+
this.pipes.forEachAlive(function(p){
73+
p.body.velocity.x = 0;
74+
}, this);
75+
},
7476

7577
restart_game: function() {
7678
this.game.time.events.remove(this.timer);

0 commit comments

Comments
 (0)