Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed explosion drawing in bottom rows

  • Loading branch information...
commit 5c7814d1e1f30237c08f390796a17584031429bc 1 parent 1251343
@MrJaba MrJaba authored
View
4 public/javascripts/explosion.js
@@ -19,7 +19,7 @@ Explosion.prototype = {
var drawX = tileX * self.frameWidth;
var drawY = tileY * self.frameHeight;
if( drawX >= -20 && drawX < self.canvas.width && drawY >= -40 && drawY < self.canvas.height ){
- self.canvas.getContext('2d').drawImage(self.img, drawFrame * self.frameWidth, direction * self.frameHeight, self.frameWidth, self.frameHeight, drawX + 10, drawY +40, self.frameWidth, self.frameHeight);
+ self.canvas.getContext('2d').drawImage(self.img, drawFrame * self.frameWidth, direction * self.frameHeight, self.frameWidth, self.frameHeight, drawX + 15, drawY, self.frameWidth, self.frameHeight);
}
});
},
@@ -36,7 +36,7 @@ Explosion.prototype = {
},
containsObstruction: function(tileX, tileY){
- return !( tileX >= 0 && tileY >= 0 && tileX < MrJaba.Bomberman.map.length && tileY < MrJaba.Bomberman.map[tileX].length && MrJaba.Bomberman.map[tileX][tileY].walkable)
+ return !( tileX >= 0 && tileY >= 0 && tileX < MrJaba.Bomberman.map.length && tileY < MrJaba.Bomberman.map.length && MrJaba.Bomberman.map[tileY][tileX].walkable)
},
tick:function(){
View
8 public/javascripts/game.js
@@ -60,7 +60,7 @@ MrJaba.Bomberman = function(){
if( MrJaba.Bomberman.me !== undefined ){
drawBombsAndExplosions(row);
drawOpponents(row);
- if( MrJaba.Bomberman.me.getRow() === row){ MrJaba.Bomberman.me.draw(); }
+ if( MrJaba.Bomberman.me.getTileY() === row){ MrJaba.Bomberman.me.draw(); }
}
}
@@ -76,10 +76,12 @@ MrJaba.Bomberman = function(){
function drawBombsAndExplosions(row){
$.each(MrJaba.Bomberman.bombs, function(uuid, bomb){
- if(bomb.getRow() === row){ bomb.draw(); }
+ console.log("bomb:"+bomb.getTileY() +" "+ row+" "+ bomb.getTileX()+" "+bomb.getTileY());
+ if(bomb.getTileY() === row){ bomb.draw(); }
});
$.each(MrJaba.Bomberman.explosions, function(uuid, explosion){
- if(explosion.getRow() === row){ explosion.draw(); }
+ console.log("explosion:"+explosion.getTileY() +" "+ row +" "+explosion.getTileX() +" "+explosion.getTileY());
+ if(explosion.getTileY() === row){ explosion.draw(); }
});
}
View
5 public/javascripts/sprite.js
@@ -80,11 +80,6 @@ Sprite.prototype = {
this.canvas.getContext('2d').drawImage(this.img,this.x,this.y,101,171);
},
- getRow:function(){
- var boardY = this.y + (this.img.height/2);
- return parseInt( boardY / MrJaba.Bomberman.Images.visibleTileHeight() );
- },
-
canMoveTo:function(newX, newY){
var tileX = this.getTileX(newX);
var tileY = this.getTileY(newY);
Please sign in to comment.
Something went wrong with that request. Please try again.