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

Mobile support for controlling bird #27

Merged
merged 7 commits into from
Mar 23, 2018
Merged

Mobile support for controlling bird #27

merged 7 commits into from
Mar 23, 2018

Conversation

matcool
Copy link
Contributor

@matcool matcool commented Mar 9, 2018

Uses touches from p5 to check if user has touched screen
probably not that useful

sketch.js Outdated
@@ -28,7 +32,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 -= speed*0.5;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer this change (Parallax, using a speed variable) to be separated from the touch controls PR, please. Also you misspelt speed in your variable declaration.

@matcool
Copy link
Contributor Author

matcool commented Mar 9, 2018

Oops i meant to change those in another branch then make it a separate pull request

Copy link
Member

@meiamsome meiamsome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave @shiffman to chose whether to merge

@shiffman
Copy link
Member

I like having this here! I wonder -- is there a simpler way to implement just using the p5 touch events and not worrying about multi-touch?

@DaGuT
Copy link
Contributor

DaGuT commented Mar 11, 2018

@shiffman there is....
@MatCorgi please, change all your code to just new function in sketch.js
:D

Just add. Not gonna commit myself, as it will not be approved anyway :D

function touchStarted() {
   bird.up();
}

@matcool
Copy link
Contributor Author

matcool commented Mar 11, 2018

I have tried that before and for some reason the bird jumps twice when touching quickly.

Seems to be an issue with p5 and chrome 56:
processing/p5.js#1811

@DaGuT
Copy link
Contributor

DaGuT commented Mar 11, 2018

I'm 50% (xD) sure that it will work properly on mobile (not in chrome dev mode)

@matcool
Copy link
Contributor Author

matcool commented Mar 11, 2018

Just tested it again and still the same thing, press once quickly and the bird jumps twice (when touch starts and ends)

I accidentally made a typo when resolving merge conflicts.
@Versatilus
Copy link
Collaborator

Awesome! Thank you!

@Versatilus Versatilus merged commit e729cec into CodingTrain:master Mar 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants