Skip to content

Commit

Permalink
Merge branch 'pr/1566' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Lionel Laské committed Mar 15, 2024
2 parents e86e98f + d68477d commit 8dfa632
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Resizing textarea in activity palette looks ugly #1303
- Player without face and color #1536
- Undeletable text in FotoToon #1549
- Blockrain: Game can start before pressing play button #1563

## [1.7.0] - 2023-03-28
### Added
Expand Down
53 changes: 26 additions & 27 deletions activities/Blockrain.activity/js/blockrain.jquery.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@
* Start/Restart Game
*/
start: function() {
this._doStart();
this.options.onStart.call(this.element);
if(!this._board.started){
this._doStart();
this.options.onStart.call(this.element);
}
},

restart: function() {
Expand All @@ -58,7 +60,7 @@
},

_doStart: function() {
this._filled.clearAll();
this._filled.clearAll(); // clear pre-builded blocks
this._filled._resetScore();
this._filled._showHighScore(); // shows high score at the beginning of game. Initial high score is 0
this._board.cur = this._board.nextShape();
Expand Down Expand Up @@ -1463,46 +1465,43 @@
var handleKeyDown = function(evt) {
if( ! game._board.cur ) { return true; }
var caught = false;

caught = true;
if (game.options.asdwKeys) {
switch(evt.keyCode) {
case 65: /*a*/ moveLeft(true); break;
case 68: /*d*/ moveRight(true); break;
case 83: /*s*/ drop(true); break;
case 87: /*w*/ game._board.cur.rotate('right'); break;
case 65: /*a*/ moveLeft(true); game.start(); break;
case 68: /*d*/ moveRight(true); game.start(); break;
case 83: /*s*/ drop(true); game.start(); break;
case 87: /*w*/ game._board.cur.rotate('right'); game.start(); break;
}
}
switch(evt.keyCode) {
case 37: /*left*/ moveLeft(true); break;
case 39: /*right*/ moveRight(true); break;
case 40: /*down*/ drop(true); break;
case 38: /*up*/ game._board.cur.rotate('right'); break;
case 88: /*x*/ game._board.cur.rotate('right'); break;
case 90: /*z*/ game._board.cur.rotate('left'); break;
case 37: /*left*/ moveLeft(true); game.start(); break;
case 39: /*right*/ moveRight(true); game.start(); break;
case 40: /*down*/ drop(true); game.start(); break;
case 38: /*up*/ game._board.cur.rotate('right'); game.start(); break;
case 88: /*x*/ game._board.cur.rotate('right'); game.start(); break;
case 90: /*z*/ game._board.cur.rotate('left'); game.start(); break;
default: caught = false;
}
if (caught) evt.preventDefault();
return !caught;
};


var handleKeyUp = function(evt) {
if( ! game._board.cur ) { return true; }
var caught = false;

caught = true;
if (game.options.asdwKeys) {
switch(evt.keyCode) {
case 65: /*a*/ moveLeft(false); break;
case 68: /*d*/ moveRight(false); break;
case 83: /*s*/ drop(false); break;
case 65: /*a*/ moveLeft(false); game.start(); break;
case 68: /*d*/ moveRight(false); game.start(); break;
case 83: /*s*/ drop(false); game.start(); break;
}
}
switch(evt.keyCode) {
case 37: /*left*/ moveLeft(false); break;
case 39: /*right*/ moveRight(false); break;
case 40: /*down*/ drop(false); break;
case 37: /*left*/ moveLeft(false); game.start(); break;
case 39: /*right*/ moveRight(false); game.start(); break;
case 40: /*down*/ drop(false); game.start(); break;
default: caught = false;
}
if (caught) evt.preventDefault();
Expand Down Expand Up @@ -1614,18 +1613,18 @@
game._$touchRotateRight.hide();
game._$touchDrop.hide();
}
$("#left-arrow").bind('touchstart click', function(event) {moveLeft(event); endMoveLeft(event)});
$("#right-arrow").bind('touchstart click', function(event) {moveRight(event); endMoveRight(event)});
$("#up-arrow").bind('touchstart click', rotateRight);
$("#down-arrow").bind('touchstart click', function(event) {drop(event); endDrop(event)});
$("#left-arrow").bind('touchstart click', function(event) {moveLeft(event); endMoveLeft(event)});
$("#right-arrow").bind('touchstart click', function(event) {moveRight(event); endMoveRight(event)});
$("#up-arrow").bind('touchstart click', rotateRight);
$("#down-arrow").bind('touchstart click', function(event) {drop(event); endDrop(event)});
},

_unbindButtons: function(){
$("#left-arrow").unbind('touchstart click');
$("#right-arrow").unbind('touchstart click');
$("#up-arrow").unbind('touchstart click');
$("#down-arrow").unbind('touchstart click');
}

});

})(jQuery));

0 comments on commit 8dfa632

Please sign in to comment.