Skip to content

Commit

Permalink
freeze
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam committed Jan 3, 2012
1 parent 30de082 commit 3880bda
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tetris.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,16 @@ function block() {
return({
x: 100,
y: 10,
velocity: {x: 0, y: blockSpeed},
tiles: tiles,
freeze: function() {
this.velocity = {x: 0, y: 0};
},
update: function(delta) {
this.y = this.y + blockSpeed * delta;
this.y = this.y + this.velocity.y * delta;
this.render();
if(_(tiles).chain().map(function(t){return t.tile;}).any(function(t1) {return grid.touches(t1)}).value()){
console.log("collision");
this.freeze()
}
},
render: function() {
Expand Down

0 comments on commit 3880bda

Please sign in to comment.