Permalink
Browse files

Release 0.1

Basic line cleared scoring
Semi-Stable
css styling
  • Loading branch information...
1 parent 11dd158 commit a81f428a89c0f7428fd7d2f7af86b9513332f207 @a727891 committed May 11, 2013
Showing with 322 additions and 161 deletions.
  1. +2 −1 FallingBlocks.jstd
  2. +11 −4 css/main.css
  3. +42 −38 index.html
  4. +16 −14 js/app.js
  5. +166 −64 js/game.js
  6. +3 −3 js/input.js
  7. +2 −2 js/main.js
  8. +67 −20 js/render.js
  9. +13 −15 test/TestGame.js
View
@@ -5,7 +5,8 @@ load:
- js/lib/class.js
test:
-- test/*.js
+#- test/*.js
+- test/TestGame.js
serve:
- js/main.js
View
@@ -92,10 +92,17 @@ textarea {
/* ==========================================================================
Author's custom styles
========================================================================== */
-.canvas{
- position: absolute;
- left: 2em;
- top: 2em;
+
+#canvas{
+ /*position: absolute;*/
+ /*left: 2em;*/
+ /*top: 2em;*/
+ background: #6e030f;
+ border: 2px solid #000000;
+ border-radius: 5px;
+ padding:3px;
+ margin-left: 20px;
+ margin-top: 20px;
}
View
@@ -1,44 +1,48 @@
<!DOCTYPE html>
-<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
-<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
-<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
-<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <title></title>
- <meta name="description" content="">
- <meta name="viewport" content="width=device-width">
+<!--[if lt IE 7]>
+<html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
+<!--[if IE 7]>
+<html class="no-js lt-ie9 lt-ie8"> <![endif]-->
+<!--[if IE 8]>
+<html class="no-js lt-ie9"> <![endif]-->
+<!--[if gt IE 8]><!-->
+<html class="no-js"> <!--<![endif]-->
+<head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+ <title></title>
+ <meta name="description" content="">
+ <meta name="viewport" content="width=device-width">
- <!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
+ <!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
- <link rel="stylesheet" href="css/normalize.css">
- <link rel="stylesheet" href="css/main.css">
- <script src="js/vendor/modernizr-2.6.2.min.js"></script>
- </head>
- <body tabindex="0">
- <!--[if lt IE 7]>
- <p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
- <![endif]-->
+ <link rel="stylesheet" href="css/normalize.css">
+ <link rel="stylesheet" href="css/main.css">
+ <script src="js/vendor/modernizr-2.6.2.min.js"></script>
+</head>
+<body tabindex="0">
+<!--[if lt IE 7]>
+<p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade
+ your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to
+ improve your experience.</p>
+<![endif]-->
- <!-- Add your site or application content here -->
- <div>
- <canvas tabindex="1" id="canvas" width="400" height="400"></canvas>
- </div>
- <div>
- Rotate [W] [UP]<br>
- Move Left [A] [LEFT]<br>
- Move Right [D] [RIGHT]<br>
- Fast Fall [S] [DOWN] [SPACE]<br>
- <br>
- Pause [ESC]<br>
- <br>
- DEBUG CHANGE PIECE [N]
- </div>
- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
- <script>window.jQuery || document.write('<script src="js/vendor/jquery-1.9.1.min.js"><\/script>')</script>
- <script src="js/plugins.js"></script>
- <script data-main="js/main" src="js/lib/require-jquery.js"></script>
+<!-- Add your site or application content here -->
+<div class=canvas>
+ <canvas tabindex="1" id="canvas" width="300" height="400"></canvas>
+</div><br>
+<div style="position: relative;">
+ Rotate [W] [UP]<br>
+ Move Left [A] [LEFT]<br>
+ Move Right [D] [RIGHT]<br>
+ Fast Fall [S] [DOWN] [SPACE]<br>
+ <br>
+ Pause [ESC]<br>
+</div>
+<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
+<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.9.1.min.js"><\/script>')</script>
+<script src="js/plugins.js"></script>
+<script data-main="js/main" src="js/lib/require-jquery.js"></script>
- </body>
+</body>
</html>
View
@@ -7,15 +7,15 @@ define([], function () {
this.isStopped = true;
this.hasNeverStarted = true;
- this.currentTime = 0;
- this.lastTimeStep = this.currentTime;
+// this.currentTime = 0;
+// this.lastTimeStep = this.currentTime;
this.game = {};
this.input = {};
this.renderer = {};
},
- setObjects: function (Game,Input,Renderer) {
+ setObjects: function (Game, Input, Renderer) {
var self = this;
self.game = Game;
self.input = Input;
@@ -26,40 +26,42 @@ define([], function () {
tick: function () {
var self = this;
- if(self.ready){
- self.currentTime = new Date().getTime();
+ if (self.ready) {
self.game.updateState(self.input.readInput());
self.renderer.render(self.isStopped);
+ if(self.game.State == self.game.gameOver){
+ self.isStopped = true;
+ }
+
if (!self.isStopped) {
requestAnimFrame(self.tick.bind(self));
}
- self.lastTimeStep = self.currentTime;
}
},
start: function () {
- if(this.ready){
+ if (this.ready) {
+ if (this.game.State == this.game.gameOver) {
+ this.game.newGame();
+ }
this.isStopped = false;
this.tick();
this.hasNeverStarted = false;
- console.info("APP: Game loop started.");
- }else{
+// console.info("APP: Game loop started.");
+ } else {
console.info("APP: Not .ready, unable to start.");
}
},
stop: function () {
- if(!this.isStopped){
+ if (!this.isStopped) {
this.isStopped = true;
- console.log("APP: Game loop paused");
+// console.log("APP: Game loop paused");
}
},
-
-
-
});
});
Oops, something went wrong.

0 comments on commit a81f428

Please sign in to comment.