Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added parallax back #32

Merged
merged 2 commits into from
Mar 10, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

var bird;
var pipes = [];
var parallax = 0.8;
var score = 0;
var maxScore = 0;
var birdIcon;
Expand All @@ -30,7 +31,7 @@ function draw() {
background(0);
// Draw our background image, then move it at the same speed as the pipes
image(bgImg, bgX, 0, bgImg.width, height);
bgX -= pipes[0].speed;
bgX -= pipes[0].speed * parallax;

// this handles the "infinite loop" by checking if the right
// edge of the image would be on the screen, if it is draw a
Expand Down