Make the bird jump & add gravity
What should we do with the bird?
Let’s make him jump:
Add below command in the file [File: create-game.js] spaceKey.onDown.add(jump, this);
Working Together
In the Replit window below, we started the code with the line spaceKey.onDown.add(jump, this);
.
In your console you should see a Jsappy bird jumping after you press run:
Add gravity
Working Together
In the Replit window below, we started the code with the line bird.body.gravity.y = 900;
.
In your console you should see a JSappy bird jumping with gravity after you press run: