-
Notifications
You must be signed in to change notification settings - Fork 157
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 GameOver(Restart button) and score board. #89
Added GameOver(Restart button) and score board. #89
Conversation
We can close #85 in favor of this, right? |
@@ -69,7 +69,23 @@ Flappy.prototype = { | |||
|
|||
//On collision code here. | |||
if (this._isCollided) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an isCollided
method which you should use in favor of the attribute.
It looks good! I added some notes on formalities. |
document.getElementById('layer7').style.display="none"; | ||
document.getElementById('layer13').style.display="none"; | ||
document.getElementById('layer14').style.display="none"; | ||
document.getElementById('layer15').style.display="none"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the style we should use.
Have a look at https://github.com/fossasia/flappy-svg/blob/gh-pages/javascript/background.js#L80
Which layers are you hiding?
@niccokunzmann I updated the code check it now. |
|
||
function onCollision(){ | ||
document.getElementById('layer17').style.display="inline"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please do not use the id. Use the name. it is more descriptive and does not change when editing with Inkscape. You can use these functions:
https://github.com/fossasia/flappy-svg/blob/gh-pages/javascript/layers.js#L60
Also I still do not know from the code what this layer17 is.
function stopAllBackgrounds(){ | ||
|
||
var keys = Object.keys(backgrounds); | ||
for (i = 0; i < keys.length; i++){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use backgrounds.length
@niccokunzmann is that fine now? |
no. two small things:
Then I would like to merge it. I understand I am criticizing a lot. Every line you do not write to achieve the goal is a line less that other people need to understand. |
for (i = 0; i < backgrounds.length; i++){ | ||
stopMovingBackgound(keys[i]); | ||
} | ||
stopMovingBackgound(flappy.stopFlapping()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the return value of stopFlapping()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry its my mistake its only be flappy.stopFlapping() instead of stopMovingBackgound(flappy.stopFlapping());
@mukesh14149 I commented on a line. If you commit, please take the time to write down what the commit means in the message. |
Ok @niccokunzmann i will take care from next time. |
@mukesh14149 It looks really good! |
…lision Added GameOver(Restart button) and score board.
Fixes issue #69
![screenshot from 2016-02-12 16 21 26](https://cloud.githubusercontent.com/assets/10887629/13005004/194b95ac-d1a5-11e5-9588-e84f5f9db116.png)
Here is the preview of starting the game.
Here is the preview when a character hit a obstacle.
![screenshot from 2016-02-12 16 21 37](https://cloud.githubusercontent.com/assets/10887629/13005019/273b47d4-d1a5-11e5-96b6-d691a76d2dd0.png)
After click on restart button it will come back to initial starting screen and right now score board does not have any functionality to do, it is just a layer.