Skip to content

Commit

Permalink
fix player swim at floor
Browse files Browse the repository at this point in the history
  • Loading branch information
Harrison Mendonça committed Aug 3, 2016
1 parent a3fc216 commit b94edad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion assets/js/playState/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,14 @@ Player.prototype.update = function() {
this.isJumping = (this.body.y < this.initialPosition.y);

//limita a tela somente no chão
if (this.body.y > 660) {
if (this.body.y >= 660) {
this.body.y = 660;

//se permanecer em baixo, dividir a velocidade positiva pela metade assim vai freiando/
//isso ajuda a poder subir rapidamente quando estiver nadando somente lá embaixo
if (this.body.velocity.y > 0) {
this.body.velocity.y /= 2;
};
}
};

Expand Down
6 changes: 3 additions & 3 deletions assets/js/playState/sequenciador/sequenciador.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ var Sequenciador = function(game, play, group) {
case 'cocolito':
case 'peixe':
var x = game.width + 150/2;
var y = element.y !== undefined ? element.y + play.initialPosition.y : game.rnd.integerInRange(play.initialPosition.y, game.height-88);
var y = element.y !== undefined ? element.y + play.initialPosition.y : game.rnd.integerInRange(play.initialPosition.y, game.height-50);
play.pool.get(element.id, x, y);
break;

Expand All @@ -375,7 +375,7 @@ var Sequenciador = function(game, play, group) {

case 'defunto':
var x = game.width + 150/2;
var y = game.rnd.integerInRange(play.initialPosition.y+120, game.height-120);
var y = game.rnd.integerInRange(play.initialPosition.y+120, game.height-100);
play.pool.get(element.id, x, y);
break;

Expand Down Expand Up @@ -422,7 +422,7 @@ var Sequenciador = function(game, play, group) {
case 'sus':
case 'injection':
var x = game.width + 225/2;
var y = element.y !== undefined ? element.y + play.initialPosition.y : game.rnd.integerInRange(play.initialPosition.y, game.height-88);
var y = element.y !== undefined ? element.y + play.initialPosition.y : game.rnd.integerInRange(play.initialPosition.y, game.height-100);
play.pool.get(element.id, x, y);
break;
}
Expand Down

0 comments on commit b94edad

Please sign in to comment.