Mercurial > mhrok3
changeset 23:d766e4073e97
tweak the razors
| author | Radomir Dopieralski <sheep-devel@sheep.art.pl> |
|---|---|
| date | Wed, 31 Oct 2012 18:43:10 +0100 |
| parents | b688f8cce051 |
| children | b4068c1de2c3 |
| files | mhrok.css mhrok.js shadow.png |
| diffstat | 3 files changed, 11 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mhrok.css Wed Oct 31 18:31:08 2012 +0100 +++ b/mhrok.css Wed Oct 31 18:43:10 2012 +0100 @@ -31,6 +31,9 @@ #mhrok .mhrok-razor .mhrok-sprite { background-image: url('effects.png'); } +#mhrok .mhrok-razor .mhrok-shadow { + background-position: -0px -96px; +} #mhrok .mhrok-shadow { width: 48px;
--- a/mhrok.js Wed Oct 31 18:31:08 2012 +0100 +++ b/mhrok.js Wed Oct 31 18:43:10 2012 +0100 @@ -305,28 +305,30 @@ return false; }; - var Razor = function (x, y, direction, level) { + var Razor = function (x, y, direction, game) { MhrokLib.Mob.apply(this, arguments); this.x = x * 32; this.y = y * 24; this.z = y; this.direction = direction; this.ttl = 100; - this.level = level; + this.game = game; }; Razor.prototype = Object.create(MhrokLib.Mob.prototype); Razor.prototype.classes += ' mhrok-razor'; Razor.prototype.animate = function (frame) { var dir = this.directions[this.direction]; - var x = Math.round(this.x / 32 - dir[0]); - var y = Math.round(this.y /24 - dir[1]); + var x = Math.round(this.x / 32 - dir[0] * 0.5); + var y = Math.round(this.y /24 - dir[1] * 0.5); this.frame = (this.frame + 1) % 8; this.frameX = 0; this.frameY = this.frame; this.x += dir[0] * 8; this.y += dir[1] * 6; + this.z = this.y; this.ttl -= 1; - if (this.ttl <= 0 || this.level.isBlocked(x + dir[0], y + dir[1])) { + if (this.ttl <= 0 || + this.game.level.isBlocked(x + dir[0], y + dir[1])) { this.dead = true; }; }; @@ -368,7 +370,7 @@ }; Hero.prototype.stab = function (game) { this.animation = 'stab'; - game.mobs.push(new Razor(this.x/32, this.y/24, this.direction, game.level)); + game.mobs.push(new Razor(this.x/32, this.y/24, this.direction, game)); return true; };
