Skip to content
Browse files

tweaks to sprite drawing

  • Loading branch information...
1 parent de7d005 commit a0eb4d5e650bd4b995a0c2414c242f06f2fa524e @MrJaba MrJaba committed May 22, 2010
Showing with 7 additions and 7 deletions.
  1. +1 −1 models/player.rb
  2. +2 −2 public/javascripts/bomb.js
  3. +3 −3 public/javascripts/explosion.js
  4. +1 −1 public/javascripts/sprite.js
View
2 models/player.rb
@@ -17,7 +17,7 @@ def update(attributes)
def respawn(cause=:start)
self.x = self.spawn.first
self.y = self.spawn.last
- self.state = 'restart' if cause == :death
+ self.state = 'restart'
end
def clearState
View
4 public/javascripts/bomb.js
@@ -9,8 +9,8 @@ function Bomb(x, y){
Bomb.prototype = {
draw:function(){
- var xPos = this.x + (this.frameWidth/2) - 37;
- var yPos = this.y + (this.img.height/2);
+ var xPos = this.x +10;
+ var yPos = this.y;
this.canvas.getContext('2d').drawImage(this.img, this.frame * this.frameWidth, 0, this.frameWidth, 108, xPos, yPos, this.frameWidth, 108)
},
View
6 public/javascripts/explosion.js
@@ -16,10 +16,10 @@ Explosion.prototype = {
var self = this;
this.tilesAround( this.getTileX(), this.getTileY(), function(tileX, tileY, direction, radius){
var drawFrame = parseInt(Math.random()*2);
- var drawX = tileX * self.frameWidth;
- var drawY = tileY * self.frameHeight;
+ var drawX = tileX * MrJaba.Bomberman.Images.tileWidth();
+ var drawY = tileY * MrJaba.Bomberman.Images.visibleTileHeight() + (self.frameHeight/2);
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 + 15, drawY, self.frameWidth, self.frameHeight);
+ self.canvas.getContext('2d').drawImage(self.img, drawFrame * self.frameWidth, direction * self.frameHeight, self.frameWidth, self.frameHeight, drawX , drawY, self.frameWidth, self.frameHeight);
}
});
},
View
2 public/javascripts/sprite.js
@@ -87,7 +87,7 @@ Sprite.prototype = {
},
draw:function(){
- this.canvas.getContext('2d').drawImage(this.img,this.x,this.y,101,171);
+ this.canvas.getContext('2d').drawImage(this.img,this.x,this.y - MrJaba.Bomberman.Images.visibleTileHeight()/2,101,171);
},
canMoveTo:function(newX, newY){

0 comments on commit a0eb4d5

Please sign in to comment.
Something went wrong with that request. Please try again.