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

Feature/control bounce #2

Merged
merged 13 commits into from
May 28, 2017
Merged

Feature/control bounce #2

merged 13 commits into from
May 28, 2017

Conversation

KtorZ
Copy link
Contributor

@KtorZ KtorZ commented May 24, 2017

No description provided.

KtorZ added 2 commits May 24, 2017 21:24
Number of frames during with the player pressed the spacebar during the 'bouncing phase' and compared to the total number of frame during this phase.
@KtorZ KtorZ requested a review from Soreine May 24, 2017 19:34
Copy link
Contributor

@Soreine Soreine left a comment

Choose a reason for hiding this comment

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

Waiting for second iteration :p

@Soreine
Copy link
Contributor

Soreine commented May 27, 2017

There's something weird with the distance I get when I play. They are statistically strange. Here is the log of the frame difference between the bounce and the input:

Bouncer.js:68 distance 0
Bouncer.js:68 distance 150
Bouncer.js:68 distance 74
Bouncer.js:68 distance 0
Bouncer.js:68 distance 42
Bouncer.js:68 distance 0
Bouncer.js:68 distance 150
Bouncer.js:68 distance 74
Bouncer.js:68 distance 0
Bouncer.js:68 distance 42
Bouncer.js:68 distance 0
Bouncer.js:68 distance 150
Bouncer.js:68 distance 74
Bouncer.js:68 distance 36
Bouncer.js:68 distance 0
Bouncer.js:68 distance 150
Bouncer.js:68 distance 74
Bouncer.js:68 distance 0
Bouncer.js:68 distance 42
Bouncer.js:68 distance 0
Bouncer.js:68 distance 150
Bouncer.js:68 distance 74
Bouncer.js:68 distance 36
Bouncer.js:68 distance 11

@Soreine
Copy link
Contributor

Soreine commented May 27, 2017

OK i fixed it, the input being not debounced, it was being registered again after the bounce resolution.
The distance progression we observed was the number of frames between successive bounces, diminishing as the disc was slowing. :)

makeSplash(game, disc);
this.bouncer.bounce();
});
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why removing them from the callback ?
Is there any benefits in terms of speed / precision ?

Copy link
Contributor

Choose a reason for hiding this comment

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

well the callback is synchronous, so yeah, it allows to do branch on collide = false too

// The disc was too slow and killed
if (!disc.alive) {
// Reset the game later
setTimeout(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

wasn't the restartTimeout solving the issue of the restart() being triggered multiple times?

Copy link
Contributor

Choose a reason for hiding this comment

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

It is, but I find this cleaner, and it does not use any additional reference

@KtorZ KtorZ force-pushed the feature/control-bounce branch from ebc9dcf to 83cd45a Compare May 27, 2017 13:28
@Soreine Soreine merged commit d19eba9 into master May 28, 2017
@Soreine Soreine deleted the feature/control-bounce branch May 28, 2017 13:15
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.

2 participants