Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

give the user a penalty for not hitting the target #1

Closed
wants to merge 1 commit into from

2 participants

@frewsxcv

introduces a more challenging aspect to the game

THIS IS GAME IS THE NEXT BIG THING

@dherman
Owner

I can't believe I'm getting pull requests for this. :)

That said, this will get spaceShip.points and the contents of the "score" div out of sync.

@dherman
Owner

Given the impending massive popularity of this game, and the critical nature of ensuring absolute correctness, I'm afraid I can't accept this patch, as it would result in the space ship score getting out of sync with the displayed score in the page.

Regardless, I thank you from the bottom of my heart for your kind words of encouragement. Today GitHub, tomorrow the world!

@dherman dherman closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 20, 2012
  1. @frewsxcv
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 0 deletions.
  1. +6 −0 twits.js
View
6 twits.js
@@ -183,6 +183,7 @@ function play(context, width, height, images) {
var firing = setInterval(function() {
var newY = shot.y - 15;
if (newY < 0) {
+ misfire();
shot.exit();
clearInterval(firing);
} else if (alien.collidesWith(shot.x, newY, shot.width(), shot.height())) {
@@ -200,6 +201,11 @@ function play(context, width, height, images) {
}
}, 30);
}
+
+ function misfire() {
+ spaceShip.score();
+ document.getElementById("score").innerHTML -= 50;
+ }
function score() {
spaceShip.score();
Something went wrong with that request. Please try again.