Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixing bug on parallax.js line 46 #45

Merged
merged 1 commit into from

3 participants

@andyjamesdavies

I notice with a vertical scroll it was incrementing based on the layer.width not the layer.height, changing this fixed the issue.

I have run the build.rb as well but you may want to run it again as the generate documentation lines didn't work (due to explicit file paths) and I didn't want to muck around with these.

@ippa
Owner

nevermind, I'll merge :). but let's not touch autogenerated files in the future :)

@ippa ippa merged commit 2582178 into ippa:master
@ippa
Owner

thanks for the patch!

@KaushiKularatnam

Thanks for the patch andy.. Brilliant :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 37 additions and 36 deletions.
  1. +35 −34 jaws-min.js
  2. +1 −1  jaws.js
  3. +1 −1  src/parallax.js
View
69 jaws-min.js
@@ -22,49 +22,50 @@ c.log("game loop loop",!0)};this.loop=function(){k.current_tick=(new Date).getTi
c,e,f);this.x=b;this.y=c;this.width=e;this.height=f;this.right=b+e;this.bottom=c+f};c.Rect.prototype.getPosition=function(){return[this.x,this.y]};c.Rect.prototype.move=function(b,c){this.x+=b;this.y+=c;this.right+=b;this.bottom+=c;return this};c.Rect.prototype.moveTo=function(b,c){this.x=b;this.y=c;this.right=this.x+this.width;this.bottom=this.y+this.height;return this};c.Rect.prototype.resize=function(b,c){this.width+=b;this.height+=c;this.right=this.x+this.width;this.bottom=this.y+this.height;
return this};c.Rect.prototype.resizeTo=function(b,c){this.width=b;this.height=c;this.right=this.x+this.width;this.bottom=this.y+this.height;return this};c.Rect.prototype.draw=function(){c.context.strokeStyle="red";c.context.strokeRect(this.x,this.y,this.width,this.height);return this};c.Rect.prototype.collidePoint=function(b,c){return b>=this.x&&b<=this.right&&c>=this.y&&c<=this.bottom};c.Rect.prototype.collideRect=function(b){return(this.x>=b.x&&this.x<=b.right||b.x>=this.x&&b.x<=this.right)&&(this.y>=
b.y&&this.y<=b.bottom||b.y>=this.y&&b.y<=this.bottom)};c.Rect.prototype.toString=function(){return"[Rect "+this.x+", "+this.y+", "+this.width+", "+this.height+"]"};return c}(jaws||{});"undefined"!==typeof module&&"exports"in module&&(module.exports=jaws.Rect);
-jaws=function(c){c.Sprite=function(b){if(!(this instanceof arguments.callee))return new arguments.callee(b);this.options=b;this.set(b);b.context?this.context=b.context:b.dom&&(this.dom=b.dom,this.createDiv());!b.context&&!b.dom&&(c.context?this.context=c.context:(this.dom=c.dom,this.createDiv()))};c.Sprite.prototype.set=function(b){this.scale_x=this.scale_y=b.scale||1;this.x=b.x||0;this.y=b.y||0;this.alpha=void 0===b.alpha?1:b.alpha;this.angle=b.angle||0;this.flipped=b.flipped||!1;this.anchor(b.anchor||
-"top_left");void 0==!b.anchor_x&&(this.anchor_x=b.anchor_x);void 0==!b.anchor_y&&(this.anchor_y=b.anchor_y);b.image&&this.setImage(b.image);this.image_path=b.image;b.scale_image&&this.scaleImage(b.scale_image);this.cacheOffsets();return this};c.Sprite.prototype.clone=function(){var b=new (this._constructor?eval(this._constructor):this.constructor)(this.attributes());b._constructor=this._constructor||this.constructor.name;return b};c.Sprite.prototype.setImage=function(b){var d=this;if(c.isDrawable(b))return this.image=
-b,this.cacheOffsets();c.assets.isLoaded(b)?(this.image=c.assets.get(b),this.cacheOffsets()):c.assets.load(b,function(){d.image=c.assets.get(b);d.cacheOffsets()});return this};c.Sprite.prototype.flip=function(){this.flipped=this.flipped?!1:!0;return this};c.Sprite.prototype.flipTo=function(b){this.flipped=b;return this};c.Sprite.prototype.rotate=function(b){this.angle+=b;return this};c.Sprite.prototype.rotateTo=function(b){this.angle=b;return this};c.Sprite.prototype.moveTo=function(b,c){this.x=b;
-this.y=c;return this};c.Sprite.prototype.move=function(b,c){b&&(this.x+=b);c&&(this.y+=c);return this};c.Sprite.prototype.scale=function(b){this.scale_x*=b;this.scale_y*=b;return this.cacheOffsets()};c.Sprite.prototype.scaleTo=function(b){this.scale_x=this.scale_y=b;return this.cacheOffsets()};c.Sprite.prototype.scaleWidth=function(b){this.scale_x*=b;return this.cacheOffsets()};c.Sprite.prototype.scaleHeight=function(b){this.scale_y*=b;return this.cacheOffsets()};c.Sprite.prototype.setX=function(b){this.x=
-b;return this};c.Sprite.prototype.setY=function(b){this.y=b;return this};c.Sprite.prototype.setTop=function(b){this.y=b+this.top_offset;return this};c.Sprite.prototype.setBottom=function(b){this.y=b-this.bottom_offset;return this};c.Sprite.prototype.setLeft=function(b){this.x=b+this.left_offset;return this};c.Sprite.prototype.setRight=function(b){this.x=b-this.right_offset;return this};c.Sprite.prototype.setWidth=function(b){this.scale_x=b/this.image.width;return this.cacheOffsets()};c.Sprite.prototype.setHeight=
-function(b){this.scale_y=b/this.image.height;return this.cacheOffsets()};c.Sprite.prototype.resize=function(b,c){this.scale_x=(this.width+b)/this.image.width;this.scale_y=(this.height+c)/this.image.height;return this.cacheOffsets()};c.Sprite.prototype.resizeTo=function(b,c){this.scale_x=b/this.image.width;this.scale_y=c/this.image.height;return this.cacheOffsets()};c.Sprite.prototype.anchor=function(b){if(a={top_left:[0,0],left_top:[0,0],center_left:[0,0.5],left_center:[0,0.5],bottom_left:[0,1],left_bottom:[0,
-1],top_center:[0.5,0],center_top:[0.5,0],center_center:[0.5,0.5],center:[0.5,0.5],bottom_center:[0.5,1],center_bottom:[0.5,1],top_right:[1,0],right_top:[1,0],center_right:[1,0.5],right_center:[1,0.5],bottom_right:[1,1],right_bottom:[1,1]}[b])this.anchor_x=a[0],this.anchor_y=a[1],this.image&&this.cacheOffsets();return this};c.Sprite.prototype.cacheOffsets=function(){if(this.image)return this.width=this.image.width*this.scale_x,this.height=this.image.height*this.scale_y,this.left_offset=this.width*
-this.anchor_x,this.top_offset=this.height*this.anchor_y,this.right_offset=this.width*(1-this.anchor_x),this.bottom_offset=this.height*(1-this.anchor_y),this.cached_rect&&this.cached_rect.resizeTo(this.width,this.height),this};c.Sprite.prototype.rect=function(){this.cached_rect||(this.cached_rect=new c.Rect(this.x,this.top,this.width,this.height));this.cached_rect.moveTo(this.x-this.left_offset,this.y-this.top_offset);return this.cached_rect};c.Sprite.prototype.createDiv=function(){this.div=document.createElement("div");
-this.div.style.position="absolute";this.image&&(this.div.style.width=this.image.width+"px",this.div.style.height=this.image.height+"px",this.div.style.backgroundImage=this.image.toDataURL?"url("+this.image.toDataURL()+")":"url("+this.image.src+")");this.dom&&this.dom.appendChild(this.div);this.updateDiv()};c.Sprite.prototype.updateDiv=function(){this.div.style.left=this.x+"px";this.div.style.top=this.y+"px";var b;b=""+("rotate("+this.angle+"deg) ");b=this.flipped?b+("scale(-"+this.scale_x+","+this.scale_y+
-")"):b+("scale("+this.scale_x+","+this.scale_y+")");this.div.style.MozTransform=b;this.div.style.WebkitTransform=b;this.div.style.OTransform=b;this.div.style.msTransform=b;this.div.style.transform=b;return this};c.Sprite.prototype.draw=function(){if(!this.image)return this;if(this.dom)return this.updateDiv();this.context.save();this.context.translate(this.x,this.y);0!=this.angle&&c.context.rotate(this.angle*Math.PI/180);this.flipped&&this.context.scale(-1,1);this.context.globalAlpha=this.alpha;this.context.translate(-this.left_offset,
--this.top_offset);this.context.drawImage(this.image,0,0,this.width,this.height);this.context.restore();return this};c.Sprite.prototype.scaleImage=function(b){if(this.image)return this.setImage(c.gfx.retroScaleImage(this.image,b)),this};c.Sprite.prototype.asCanvasContext=function(){var b=document.createElement("canvas");b.width=this.width;b.height=this.height;b=b.getContext("2d");b.mozImageSmoothingEnabled=c.context.mozImageSmoothingEnabled;b.drawImage(this.image,0,0,this.width,this.height);return b};
-c.Sprite.prototype.asCanvas=function(){var b=document.createElement("canvas");b.width=this.width;b.height=this.height;var d=b.getContext("2d");d.mozImageSmoothingEnabled=c.context.mozImageSmoothingEnabled;d.drawImage(this.image,0,0,this.width,this.height);return b};c.Sprite.prototype.toString=function(){return"[Sprite "+this.x.toFixed(2)+", "+this.y.toFixed(2)+", "+this.width+", "+this.height+"]"};c.Sprite.prototype.attributes=function(){var b=this.options;b._constructor=this._constructor||"jaws.Sprite";
-b.x=parseFloat(this.x.toFixed(2));b.y=parseFloat(this.y.toFixed(2));b.image=this.image_path;b.alpha=this.alpha;b.flipped=this.flipped;b.angle=parseFloat(this.angle.toFixed(2));b.scale_x=this.scale_x;b.scale_y=this.scale_y;b.anchor_x=this.anchor_x;b.anchor_y=this.anchor_y;return b};c.Sprite.prototype.toJSON=function(){return JSON.stringify(this.attributes())};return c}(jaws||{});"undefined"!==typeof module&&"exports"in module&&(module.exports=jaws.Sprite);
+jaws=function(c){c.Sprite=function(b){if(!(this instanceof arguments.callee))return new arguments.callee(b);this.options=b;this.set(b);if(b.context)this.context=b.context;else if(b.dom){this.dom=b.dom;this.createDiv()}if(!b.context&&!b.dom)if(c.context)this.context=c.context;else{this.dom=c.dom;this.createDiv()}};c.Sprite.prototype.set=function(b){this.scale_x=this.scale_y=b.scale||1;this.x=b.x||0;this.y=b.y||0;this.alpha=b.alpha===void 0?1:b.alpha;this.angle=b.angle||0;this.flipped=b.flipped||false;
+this.anchor(b.anchor||"top_left");if(!b.anchor_x==void 0)this.anchor_x=b.anchor_x;if(!b.anchor_y==void 0)this.anchor_y=b.anchor_y;b.image&&this.setImage(b.image);this.image_path=b.image;b.scale_image&&this.scaleImage(b.scale_image);this.cacheOffsets();return this};c.Sprite.prototype.clone=function(){var b=new (this._constructor?eval(this._constructor):this.constructor)(this.attributes());b._constructor=this._constructor||this.constructor.name;return b};c.Sprite.prototype.setImage=function(b){var d=
+this;if(c.isDrawable(b)){this.image=b;return this.cacheOffsets()}if(c.assets.isLoaded(b)){this.image=c.assets.get(b);this.cacheOffsets()}else c.assets.load(b,function(){d.image=c.assets.get(b);d.cacheOffsets()});return this};c.Sprite.prototype.flip=function(){this.flipped=this.flipped?false:true;return this};c.Sprite.prototype.flipTo=function(b){this.flipped=b;return this};c.Sprite.prototype.rotate=function(b){this.angle=this.angle+b;return this};c.Sprite.prototype.rotateTo=function(b){this.angle=
+b;return this};c.Sprite.prototype.moveTo=function(b,c){this.x=b;this.y=c;return this};c.Sprite.prototype.move=function(b,c){if(b)this.x=this.x+b;if(c)this.y=this.y+c;return this};c.Sprite.prototype.scale=function(b){this.scale_x=this.scale_x*b;this.scale_y=this.scale_y*b;return this.cacheOffsets()};c.Sprite.prototype.scaleTo=function(b){this.scale_x=this.scale_y=b;return this.cacheOffsets()};c.Sprite.prototype.scaleWidth=function(b){this.scale_x=this.scale_x*b;return this.cacheOffsets()};c.Sprite.prototype.scaleHeight=
+function(b){this.scale_y=this.scale_y*b;return this.cacheOffsets()};c.Sprite.prototype.setX=function(b){this.x=b;return this};c.Sprite.prototype.setY=function(b){this.y=b;return this};c.Sprite.prototype.setTop=function(b){this.y=b+this.top_offset;return this};c.Sprite.prototype.setBottom=function(b){this.y=b-this.bottom_offset;return this};c.Sprite.prototype.setLeft=function(b){this.x=b+this.left_offset;return this};c.Sprite.prototype.setRight=function(b){this.x=b-this.right_offset;return this};c.Sprite.prototype.setWidth=
+function(b){this.scale_x=b/this.image.width;return this.cacheOffsets()};c.Sprite.prototype.setHeight=function(b){this.scale_y=b/this.image.height;return this.cacheOffsets()};c.Sprite.prototype.resize=function(b,c){this.scale_x=(this.width+b)/this.image.width;this.scale_y=(this.height+c)/this.image.height;return this.cacheOffsets()};c.Sprite.prototype.resizeTo=function(b,c){this.scale_x=b/this.image.width;this.scale_y=c/this.image.height;return this.cacheOffsets()};c.Sprite.prototype.anchor=function(b){if(a=
+{top_left:[0,0],left_top:[0,0],center_left:[0,0.5],left_center:[0,0.5],bottom_left:[0,1],left_bottom:[0,1],top_center:[0.5,0],center_top:[0.5,0],center_center:[0.5,0.5],center:[0.5,0.5],bottom_center:[0.5,1],center_bottom:[0.5,1],top_right:[1,0],right_top:[1,0],center_right:[1,0.5],right_center:[1,0.5],bottom_right:[1,1],right_bottom:[1,1]}[b]){this.anchor_x=a[0];this.anchor_y=a[1];this.image&&this.cacheOffsets()}return this};c.Sprite.prototype.cacheOffsets=function(){if(this.image){this.width=this.image.width*
+this.scale_x;this.height=this.image.height*this.scale_y;this.left_offset=this.width*this.anchor_x;this.top_offset=this.height*this.anchor_y;this.right_offset=this.width*(1-this.anchor_x);this.bottom_offset=this.height*(1-this.anchor_y);this.cached_rect&&this.cached_rect.resizeTo(this.width,this.height);return this}};c.Sprite.prototype.rect=function(){if(!this.cached_rect)this.cached_rect=new c.Rect(this.x,this.top,this.width,this.height);this.cached_rect.moveTo(this.x-this.left_offset,this.y-this.top_offset);
+return this.cached_rect};c.Sprite.prototype.createDiv=function(){this.div=document.createElement("div");this.div.style.position="absolute";if(this.image){this.div.style.width=this.image.width+"px";this.div.style.height=this.image.height+"px";this.div.style.backgroundImage=this.image.toDataURL?"url("+this.image.toDataURL()+")":"url("+this.image.src+")"}this.dom&&this.dom.appendChild(this.div);this.updateDiv()};c.Sprite.prototype.updateDiv=function(){this.div.style.left=this.x+"px";this.div.style.top=
+this.y+"px";var b;b=""+("rotate("+this.angle+"deg) ");b=this.flipped?b+("scale(-"+this.scale_x+","+this.scale_y+")"):b+("scale("+this.scale_x+","+this.scale_y+")");this.div.style.MozTransform=b;this.div.style.WebkitTransform=b;this.div.style.OTransform=b;this.div.style.msTransform=b;this.div.style.transform=b;return this};c.Sprite.prototype.draw=function(){if(!this.image)return this;if(this.dom)return this.updateDiv();this.context.save();this.context.translate(this.x,this.y);this.angle!=0&&c.context.rotate(this.angle*
+Math.PI/180);this.flipped&&this.context.scale(-1,1);this.context.globalAlpha=this.alpha;this.context.translate(-this.left_offset,-this.top_offset);this.context.drawImage(this.image,0,0,this.width,this.height);this.context.restore();return this};c.Sprite.prototype.scaleImage=function(b){if(this.image){this.setImage(c.gfx.retroScaleImage(this.image,b));return this}};c.Sprite.prototype.asCanvasContext=function(){var b=document.createElement("canvas");b.width=this.width;b.height=this.height;b=b.getContext("2d");
+b.mozImageSmoothingEnabled=c.context.mozImageSmoothingEnabled;b.drawImage(this.image,0,0,this.width,this.height);return b};c.Sprite.prototype.asCanvas=function(){var b=document.createElement("canvas");b.width=this.width;b.height=this.height;var d=b.getContext("2d");d.mozImageSmoothingEnabled=c.context.mozImageSmoothingEnabled;d.drawImage(this.image,0,0,this.width,this.height);return b};c.Sprite.prototype.toString=function(){return"[Sprite "+this.x.toFixed(2)+", "+this.y.toFixed(2)+", "+this.width+
+", "+this.height+"]"};c.Sprite.prototype.attributes=function(){var b=this.options;b._constructor=this._constructor||"jaws.Sprite";b.x=parseFloat(this.x.toFixed(2));b.y=parseFloat(this.y.toFixed(2));b.image=this.image_path;b.alpha=this.alpha;b.flipped=this.flipped;b.angle=parseFloat(this.angle.toFixed(2));b.scale_x=this.scale_x;b.scale_y=this.scale_y;b.anchor_x=this.anchor_x;b.anchor_y=this.anchor_y;return b};c.Sprite.prototype.toJSON=function(){return JSON.stringify(this.attributes())};return c}(jaws||
+{});"undefined"!==typeof module&&"exports"in module&&(module.exports=jaws.Sprite);
jaws=function(c){c.SpriteList=function(b){if(!(this instanceof arguments.callee))return new arguments.callee(b);this.sprites=[];this.length=0;b&&this.load(b)};c.SpriteList.prototype.at=function(b){return this.sprites[b]};c.SpriteList.prototype.concat=function(){return this.sprites.concat.apply(this.sprites,arguments)};c.SpriteList.prototype.indexOf=function(b,c){return this.sprites.indexOf(b,c)};c.SpriteList.prototype.join=function(b){return this.sprites.join(b)};c.SpriteList.prototype.lastIndexOf=
function(){return this.sprites.lastIndexOf.apply(this.sprites,arguments)};c.SpriteList.prototype.pop=function(){var b=this.sprites.pop();this.updateLength();return b};c.SpriteList.prototype.push=function(){this.sprites.push.apply(this.sprites,arguments);this.updateLength();return this.length};c.SpriteList.prototype.reverse=function(){this.sprites.reverse()};c.SpriteList.prototype.shift=function(){var b=this.sprites.shift();this.updateLength();return b};c.SpriteList.prototype.slice=function(b,c){return this.sprites.slice(b,
c)};c.SpriteList.prototype.sort=function(){this.sprites.sort.apply(this.sprites,arguments)};c.SpriteList.prototype.splice=function(){var b=this.sprites.splice.apply(this.sprites,arguments);this.updateLength();return b};c.SpriteList.prototype.unshift=function(){this.sprites.unshift.apply(this.sprites,arguments);this.updateLength();return this.length};c.SpriteList.prototype.updateLength=function(){this.length=this.sprites.length};c.SpriteList.prototype.valueOf=function(){return this.toString()};c.SpriteList.prototype.filter=
function(){return this.sprites.filter.apply(this.sprites,arguments)};c.SpriteList.prototype.forEach=function(){this.sprites.forEach.apply(this.sprites,arguments);this.updateLength()};c.SpriteList.prototype.every=function(){return this.sprites.every.apply(this.sprites,arguments)};c.SpriteList.prototype.map=function(){return this.sprites.map.apply(this.sprites,arguments)};c.SpriteList.prototype.reduce=function(){return this.sprites.reduce.apply(this.sprites,arguments)};c.SpriteList.prototype.reduceRight=
-function(){return this.sprites.reduceRight.apply(this.sprites,arguments)};c.SpriteList.prototype.some=function(){return this.sprites.some.apply(this.sprites,arguments)};c.SpriteList.prototype.isSpriteList=function(){return!0};c.SpriteList.prototype.load=function(b){function d(b){b.forEach(function(b){var d=b._constructor?eval(b._constructor):b.constructor;c.isFunction(d)&&(c.log("Creating "+b._constructor+"("+b.toString()+")",!0),d=new d(b),d._constructor=b._constructor||b.constructor.name,e.push(d))})}
-var e=this;c.isArray(b)?b.every(function(b){return b._constructor})?d(b):this.sprites=b:c.isString(b)&&(d(JSON.parse(b)),console.log(b));this.updateLength()};c.SpriteList.prototype.remove=function(b){b=this.indexOf(b);-1<b&&this.splice(b,1);this.updateLength()};c.SpriteList.prototype.draw=function(){this.forEach(function(b){b.draw()})};c.SpriteList.prototype.drawIf=function(b){this.forEach(function(c){b(c)&&c.draw()})};c.SpriteList.prototype.update=function(){this.forEach(function(b){b.update()})};
+function(){return this.sprites.reduceRight.apply(this.sprites,arguments)};c.SpriteList.prototype.some=function(){return this.sprites.some.apply(this.sprites,arguments)};c.SpriteList.prototype.isSpriteList=function(){return true};c.SpriteList.prototype.load=function(b){function d(b){b.forEach(function(b){var d=b._constructor?eval(b._constructor):b.constructor;if(c.isFunction(d)){c.log("Creating "+b._constructor+"("+b.toString()+")",true);d=new d(b);d._constructor=b._constructor||b.constructor.name;
+e.push(d)}})}var e=this;if(c.isArray(b))b.every(function(b){return b._constructor})?d(b):this.sprites=b;else if(c.isString(b)){d(JSON.parse(b));console.log(b)}this.updateLength()};c.SpriteList.prototype.remove=function(b){b=this.indexOf(b);b>-1&&this.splice(b,1);this.updateLength()};c.SpriteList.prototype.draw=function(){this.forEach(function(b){b.draw()})};c.SpriteList.prototype.drawIf=function(b){this.forEach(function(c){b(c)&&c.draw()})};c.SpriteList.prototype.update=function(){this.forEach(function(b){b.update()})};
c.SpriteList.prototype.updateIf=function(b){this.forEach(function(c){b(c)&&c.update()})};c.SpriteList.prototype.deleteIf=function(b){this.removeIf(b)};c.SpriteList.prototype.removeIf=function(b){this.sprites=this.filter(function(c){return!b(c)});this.updateLength()};c.SpriteList.prototype.toString=function(){return"[SpriteList "+this.length+" sprites]"};return c}(jaws||{});
jaws=function(c){function b(b,c,f,g,j){var h=document.createElement("canvas");h.width=g;h.height=j;h.getContext("2d").drawImage(b,c,f,g,j,0,0,h.width,h.height);return h}c.SpriteSheet=function(d){if(!(this instanceof arguments.callee))return new arguments.callee(d);this.image=c.isDrawable(d.image)?d.image:c.assets.data[d.image];this.orientation=d.orientation||"down";this.frame_size=d.frame_size||[32,32];this.frames=[];this.offset=d.offset||0;if(d.scale_image){var e=c.isDrawable(d.image)?d.image:c.assets.get(d.image);
-this.frame_size[0]*=d.scale_image;this.frame_size[1]*=d.scale_image;d.image=c.gfx.retroScaleImage(e,d.scale_image)}if("down"==this.orientation)for(e=this.offset;e<this.image.width;e+=this.frame_size[0])for(var f=0;f<this.image.height;f+=this.frame_size[1])this.frames.push(b(this.image,e,f,this.frame_size[0],this.frame_size[1]));else for(f=this.offset;f<this.image.height;f+=this.frame_size[1])for(e=0;e<this.image.width;e+=this.frame_size[0])this.frames.push(b(this.image,e,f,this.frame_size[0],this.frame_size[1]))};
-c.SpriteSheet.prototype.toString=function(){return"[SpriteSheet "+this.frames.length+" frames]"};return c}(jaws||{});
-jaws=function(c){c.Parallax=function(b){if(!(this instanceof arguments.callee))return new arguments.callee(b);this.scale=b.scale||1;this.repeat_x=b.repeat_x;this.repeat_y=b.repeat_y;this.camera_x=b.camera_x||0;this.camera_y=b.camera_y||0;this.layers=[]};c.Parallax.prototype.draw=function(){for(var b,d,e,f=0;f<this.layers.length;f++){b=this.layers[f];d=b.x;e=b.y;b.x=-(this.camera_x/b.damping);for(b.y=-(this.camera_y/b.damping);this.repeat_x&&0<b.x;)b.x-=b.width;for(;this.repeat_y&&0<b.y;)b.y-=b.width;
-for(;this.repeat_x&&b.x<c.width;){for(;this.repeat_y&&b.y<c.height;)b.draw(),b.y+=b.height;b.y=e;b.draw();b.x+=b.width-1}for(;b.repeat_y&&!b.repeat_x&&b.y<c.height;)b.draw(),b.y+=b.height;b.x=d}};c.Parallax.prototype.addLayer=function(b){b=new c.ParallaxLayer(b);b.scale(this.scale);this.layers.push(b)};c.Parallax.prototype.toString=function(){return"[Parallax "+this.x+", "+this.y+". "+this.layers.length+" layers]"};c.ParallaxLayer=function(b){if(!(this instanceof arguments.callee))return new arguments.callee(b);
+this.frame_size[0]=this.frame_size[0]*d.scale_image;this.frame_size[1]=this.frame_size[1]*d.scale_image;d.image=c.gfx.retroScaleImage(e,d.scale_image)}if(this.orientation=="down")for(e=this.offset;e<this.image.width;e=e+this.frame_size[0])for(var f=0;f<this.image.height;f=f+this.frame_size[1])this.frames.push(b(this.image,e,f,this.frame_size[0],this.frame_size[1]));else for(f=this.offset;f<this.image.height;f=f+this.frame_size[1])for(e=0;e<this.image.width;e=e+this.frame_size[0])this.frames.push(b(this.image,
+e,f,this.frame_size[0],this.frame_size[1]))};c.SpriteSheet.prototype.toString=function(){return"[SpriteSheet "+this.frames.length+" frames]"};return c}(jaws||{});
+jaws=function(c){c.Parallax=function(b){if(!(this instanceof arguments.callee))return new arguments.callee(b);this.scale=b.scale||1;this.repeat_x=b.repeat_x;this.repeat_y=b.repeat_y;this.camera_x=b.camera_x||0;this.camera_y=b.camera_y||0;this.layers=[]};c.Parallax.prototype.draw=function(){for(var b,d,e,f=0;f<this.layers.length;f++){b=this.layers[f];d=b.x;e=b.y;b.x=-(this.camera_x/b.damping);for(b.y=-(this.camera_y/b.damping);this.repeat_x&&b.x>0;)b.x=b.x-b.width;for(;this.repeat_y&&b.y>0;)b.y=b.y-
+b.height;for(;this.repeat_x&&b.x<c.width;){for(;this.repeat_y&&b.y<c.height;){b.draw();b.y=b.y+b.height}b.y=e;b.draw();b.x=b.x+(b.width-1)}for(;b.repeat_y&&!b.repeat_x&&b.y<c.height;){b.draw();b.y=b.y+b.height}b.x=d}};c.Parallax.prototype.addLayer=function(b){b=new c.ParallaxLayer(b);b.scale(this.scale);this.layers.push(b)};c.Parallax.prototype.toString=function(){return"[Parallax "+this.x+", "+this.y+". "+this.layers.length+" layers]"};c.ParallaxLayer=function(b){if(!(this instanceof arguments.callee))return new arguments.callee(b);
this.damping=b.damping||0;c.Sprite.call(this,b)};c.ParallaxLayer.prototype=c.Sprite.prototype;return c}(jaws||{});
-jaws=function(c){c.Animation=function(b){if(!(this instanceof arguments.callee))return new arguments.callee(b);this.options=b;this.frames=b.frames||[];this.frame_duration=b.frame_duration||100;this.index=b.index||0;this.loop=void 0==b.loop?1:b.loop;this.bounce=b.bounce||0;this.frame_direction=1;this.frame_size=b.frame_size;this.orientation=b.orientation||"down";this.on_end=b.on_end||null;this.offset=b.offset||0;if(b.scale_image){var d=c.isDrawable(b.sprite_sheet)?b.sprite_sheet:c.assets.get(b.sprite_sheet);
-this.frame_size[0]*=b.scale_image;this.frame_size[1]*=b.scale_image;b.sprite_sheet=c.gfx.retroScaleImage(d,b.scale_image)}b.sprite_sheet&&(d=c.isDrawable(b.sprite_sheet)?b.sprite_sheet:c.assets.get(b.sprite_sheet),this.frames=(new c.SpriteSheet({image:d,frame_size:this.frame_size,orientation:this.orientation,offset:this.offset})).frames);this.current_tick=(new Date).getTime();this.last_tick=(new Date).getTime();this.sum_tick=0};c.Animation.prototype.update=function(){this.current_tick=(new Date).getTime();
-this.sum_tick+=this.current_tick-this.last_tick;this.last_tick=this.current_tick;this.sum_tick>this.frame_duration&&(this.index+=this.frame_direction,this.sum_tick=0);if(this.index>=this.frames.length||0>this.index)this.bounce?(this.frame_direction=-this.frame_direction,this.index+=2*this.frame_direction):this.loop?this.index=0:(this.index-=this.frame_direction,this.on_end&&(this.on_end(),this.on_end=null));return this};c.Animation.prototype.slice=function(b,d){var e={};e.frame_duration=this.frame_duration;
-e.loop=this.loop;e.bounce=this.bounce;e.on_end=this.on_end;e.frame_direction=this.frame_direction;e.frames=this.frames.slice().slice(b,d);return new c.Animation(e)};c.Animation.prototype.next=function(){this.update();return this.frames[this.index]};c.Animation.prototype.atLastFrame=function(){return this.index==this.frames.length-1};c.Animation.prototype.atFirstFrame=function(){return 0==this.index};c.Animation.prototype.currentFrame=function(){return this.frames[this.index]};c.Animation.prototype.toString=
-function(){return"[Animation, "+this.frames.length+" frames]"};return c}(jaws||{});
-jaws=function(c){c.Viewport=function(b){if(!(this instanceof arguments.callee))return new arguments.callee(b);this.options=b;this.context=b.context||c.context;this.width=b.width||c.width;this.height=b.height||c.height;this.max_x=b.max_x||c.width;this.max_y=b.max_y||c.height;this.x=b.x||0;this.y=b.y||0;var d=this;this.move=function(b,c){b&&(this.x+=b);c&&(this.y+=c);this.verifyPosition()};this.moveTo=function(b,c){void 0!=b&&(this.x=b);void 0!=c&&(this.y=c);this.verifyPosition()};this.isOutside=function(b){return!d.isInside(b)};
-this.isInside=function(b){return b.x>=d.x&&b.x<=d.x+d.width&&b.y>=d.y&&b.y<=d.y+d.height};this.isPartlyInside=function(b){var c=b.rect();return c.right>=d.x&&c.x<=d.x+d.width&&c.bottom>=d.y&&b.y<=d.y+d.height};this.isLeftOf=function(b){return b.x<d.x};this.isRightOf=function(b){return b.x>d.x+d.width};this.isAbove=function(b){return b.y<d.y};this.isBelow=function(b){return b.y>d.y+d.height};this.centerAround=function(b){this.x=b.x-this.width/2;this.y=b.y-this.height/2;this.verifyPosition()};this.forceInsideVisibleArea=
-function(b,d){b.x<this.x+d&&(b.x=this.x+d);b.x>this.x+c.width-d&&(b.x=this.x+c.width-d);b.y<this.y+d&&(b.y=this.y+d);b.y>this.y+c.height-d&&(b.y=this.y+c.height-d)};this.forceInside=function(b,c){b.x<c&&(b.x=c);b.x>this.max_x-c&&(b.x=this.max_x-c);b.y<c&&(b.y=c);b.y>this.max_y-c&&(b.y=this.max_y-c)};this.apply=function(b){this.context.save();this.context.translate(-this.x,-this.y);b();this.context.restore()};this.draw=function(b){this.apply(function(){b.forEach?b.forEach(d.drawIfPartlyInside):b.draw&&
-d.drawIfPartlyInside(b)})};this.drawTileMap=function(b){var c=b.atRect({x:this.x,y:this.y,right:this.x+this.width,bottom:this.y+this.height});this.apply(function(){for(var b=0;b<c.length;b++)c[b].draw()})};this.drawIfPartlyInside=function(b){d.isPartlyInside(b)&&b.draw()};this.verifyPosition=function(){var b=this.max_x-this.width;0>this.x&&(this.x=0);this.x>b&&(this.x=b);b=this.max_y-this.height;0>this.y&&(this.y=0);this.y>b&&(this.y=b)};this.moveTo(b.x||0,b.y||0)};c.Viewport.prototype.toString=function(){return"[Viewport "+
-this.x.toFixed(2)+", "+this.y.toFixed(2)+", "+this.width+", "+this.height+"]"};return c}(jaws||{});
+jaws=function(c){c.Animation=function(b){if(!(this instanceof arguments.callee))return new arguments.callee(b);this.options=b;this.frames=b.frames||[];this.frame_duration=b.frame_duration||100;this.index=b.index||0;this.loop=b.loop==void 0?1:b.loop;this.bounce=b.bounce||0;this.frame_direction=1;this.frame_size=b.frame_size;this.orientation=b.orientation||"down";this.on_end=b.on_end||null;this.offset=b.offset||0;if(b.scale_image){var d=c.isDrawable(b.sprite_sheet)?b.sprite_sheet:c.assets.get(b.sprite_sheet);
+this.frame_size[0]=this.frame_size[0]*b.scale_image;this.frame_size[1]=this.frame_size[1]*b.scale_image;b.sprite_sheet=c.gfx.retroScaleImage(d,b.scale_image)}if(b.sprite_sheet){d=c.isDrawable(b.sprite_sheet)?b.sprite_sheet:c.assets.get(b.sprite_sheet);this.frames=(new c.SpriteSheet({image:d,frame_size:this.frame_size,orientation:this.orientation,offset:this.offset})).frames}this.current_tick=(new Date).getTime();this.last_tick=(new Date).getTime();this.sum_tick=0};c.Animation.prototype.update=function(){this.current_tick=
+(new Date).getTime();this.sum_tick=this.sum_tick+(this.current_tick-this.last_tick);this.last_tick=this.current_tick;if(this.sum_tick>this.frame_duration){this.index=this.index+this.frame_direction;this.sum_tick=0}if(this.index>=this.frames.length||this.index<0)if(this.bounce){this.frame_direction=-this.frame_direction;this.index=this.index+this.frame_direction*2}else if(this.loop)this.index=0;else{this.index=this.index-this.frame_direction;if(this.on_end){this.on_end();this.on_end=null}}return this};
+c.Animation.prototype.slice=function(b,d){var e={};e.frame_duration=this.frame_duration;e.loop=this.loop;e.bounce=this.bounce;e.on_end=this.on_end;e.frame_direction=this.frame_direction;e.frames=this.frames.slice().slice(b,d);return new c.Animation(e)};c.Animation.prototype.next=function(){this.update();return this.frames[this.index]};c.Animation.prototype.atLastFrame=function(){return this.index==this.frames.length-1};c.Animation.prototype.atFirstFrame=function(){return this.index==0};c.Animation.prototype.currentFrame=
+function(){return this.frames[this.index]};c.Animation.prototype.toString=function(){return"[Animation, "+this.frames.length+" frames]"};return c}(jaws||{});
+jaws=function(c){c.Viewport=function(b){if(!(this instanceof arguments.callee))return new arguments.callee(b);this.options=b;this.context=b.context||c.context;this.width=b.width||c.width;this.height=b.height||c.height;this.max_x=b.max_x||c.width;this.max_y=b.max_y||c.height;this.x=b.x||0;this.y=b.y||0;var d=this;this.move=function(b,c){b&&(this.x=this.x+b);c&&(this.y=this.y+c);this.verifyPosition()};this.moveTo=function(b,c){if(b!=void 0)this.x=b;if(c!=void 0)this.y=c;this.verifyPosition()};this.isOutside=
+function(b){return!d.isInside(b)};this.isInside=function(b){return b.x>=d.x&&b.x<=d.x+d.width&&b.y>=d.y&&b.y<=d.y+d.height};this.isPartlyInside=function(b){var c=b.rect();return c.right>=d.x&&c.x<=d.x+d.width&&c.bottom>=d.y&&b.y<=d.y+d.height};this.isLeftOf=function(b){return b.x<d.x};this.isRightOf=function(b){return b.x>d.x+d.width};this.isAbove=function(b){return b.y<d.y};this.isBelow=function(b){return b.y>d.y+d.height};this.centerAround=function(b){this.x=b.x-this.width/2;this.y=b.y-this.height/
+2;this.verifyPosition()};this.forceInsideVisibleArea=function(b,d){if(b.x<this.x+d)b.x=this.x+d;if(b.x>this.x+c.width-d)b.x=this.x+c.width-d;if(b.y<this.y+d)b.y=this.y+d;if(b.y>this.y+c.height-d)b.y=this.y+c.height-d};this.forceInside=function(b,c){if(b.x<c)b.x=c;if(b.x>this.max_x-c)b.x=this.max_x-c;if(b.y<c)b.y=c;if(b.y>this.max_y-c)b.y=this.max_y-c};this.apply=function(b){this.context.save();this.context.translate(-this.x,-this.y);b();this.context.restore()};this.draw=function(b){this.apply(function(){b.forEach?
+b.forEach(d.drawIfPartlyInside):b.draw&&d.drawIfPartlyInside(b)})};this.drawTileMap=function(b){var c=b.atRect({x:this.x,y:this.y,right:this.x+this.width,bottom:this.y+this.height});this.apply(function(){for(var b=0;b<c.length;b++)c[b].draw()})};this.drawIfPartlyInside=function(b){d.isPartlyInside(b)&&b.draw()};this.verifyPosition=function(){var b=this.max_x-this.width;if(this.x<0)this.x=0;if(this.x>b)this.x=b;b=this.max_y-this.height;if(this.y<0)this.y=0;if(this.y>b)this.y=b};this.moveTo(b.x||0,
+b.y||0)};c.Viewport.prototype.toString=function(){return"[Viewport "+this.x.toFixed(2)+", "+this.y.toFixed(2)+", "+this.width+", "+this.height+"]"};return c}(jaws||{});
jaws=function(c){c.TileMap=function(b){if(!(this instanceof arguments.callee))return new arguments.callee(b);this.cell_size=b.cell_size||[32,32];this.size=b.size||[100,100];this.sortFunction=b.sortFunction;this.cells=Array(this.size[0]);for(var c=0;c<this.size[0];c++){this.cells[c]=Array(this.size[1]);for(var e=0;e<this.size[1];e++)this.cells[c][e]=[]}};c.TileMap.prototype.clear=function(){for(var b=0;b<this.size[0];b++)for(var c=0;c<this.size[1];c++)this.cells[b][c]=[]};c.TileMap.prototype.sortCells=
-function(b){for(var c=0;c<this.size[0];c++)for(var e=0;e<this.size[1];e++)this.cells[c][e].sort(b)};c.TileMap.prototype.push=function(b){var c=this;if(b.forEach)return b.forEach(function(b){c.push(b)}),b;if(b.rect)return this.pushAsRect(b,b.rect());var e=parseInt(b.x/this.cell_size[0]),f=parseInt(b.y/this.cell_size[1]);return this.pushToCell(e,f,b)};c.TileMap.prototype.pushAsPoint=function(b){if(Array.isArray(b)){for(var c=0;c<b.length;c++)this.pushAsPoint(b[c]);return b}var c=parseInt(b.x/this.cell_size[0]),
+function(b){for(var c=0;c<this.size[0];c++)for(var e=0;e<this.size[1];e++)this.cells[c][e].sort(b)};c.TileMap.prototype.push=function(b){var c=this;if(b.forEach){b.forEach(function(b){c.push(b)});return b}if(b.rect)return this.pushAsRect(b,b.rect());var e=parseInt(b.x/this.cell_size[0]),f=parseInt(b.y/this.cell_size[1]);return this.pushToCell(e,f,b)};c.TileMap.prototype.pushAsPoint=function(b){if(Array.isArray(b)){for(var c=0;c<b.length;c++)this.pushAsPoint(b[c]);return b}var c=parseInt(b.x/this.cell_size[0]),
e=parseInt(b.y/this.cell_size[1]);return this.pushToCell(c,e,b)};c.TileMap.prototype.pushAsRect=function(b,c){for(var e=parseInt(c.x/this.cell_size[0]),f=parseInt((c.right-1)/this.cell_size[0]);e<=f;e++)for(var g=parseInt(c.y/this.cell_size[1]),j=parseInt((c.bottom-1)/this.cell_size[1]);g<=j;g++)this.pushToCell(e,g,b);return b};c.TileMap.prototype.pushToCell=function(b,c,e){this.cells[b][c].push(e);this.sortFunction&&this.cells[b][c].sort(this.sortFunction);return this};c.TileMap.prototype.at=function(b,
-c){var e=parseInt(b/this.cell_size[0]),f=parseInt(c/this.cell_size[1]);return this.cells[e][f]};c.TileMap.prototype.atRect=function(b){var c=[];try{var e=parseInt(b.x/this.cell_size[0]);0>e&&(e=0);var f=parseInt(b.right/this.cell_size[0]);f>=this.size[0]&&(f=this.size[0]-1);var g=parseInt(b.y/this.cell_size[1]);0>g&&(g=0);var j=parseInt(b.bottom/this.cell_size[1]);j>=this.size[1]&&(j=this.size[1]-1);for(b=e;b<=f;b++)for(e=g;e<=j;e++)this.cells[b][e].forEach(function(b){-1==c.indexOf(b)&&c.push(b)})}catch(h){}return c};
+c){var e=parseInt(b/this.cell_size[0]),f=parseInt(c/this.cell_size[1]);return this.cells[e][f]};c.TileMap.prototype.atRect=function(b){var c=[];try{var e=parseInt(b.x/this.cell_size[0]);e<0&&(e=0);var f=parseInt(b.right/this.cell_size[0]);f>=this.size[0]&&(f=this.size[0]-1);var g=parseInt(b.y/this.cell_size[1]);g<0&&(g=0);var j=parseInt(b.bottom/this.cell_size[1]);j>=this.size[1]&&(j=this.size[1]-1);for(b=e;b<=f;b++)for(e=g;e<=j;e++)this.cells[b][e].forEach(function(b){c.indexOf(b)==-1&&c.push(b)})}catch(h){}return c};
c.TileMap.prototype.all=function(){for(var b=[],c=0;c<this.size[0];c++)for(var e=0;e<this.size[1];e++)this.cells[c][e].forEach(function(c){b.push(c)});return b};c.TileMap.prototype.cell=function(b,c){return this.cells[b][c]};c.TileMap.prototype.toString=function(){return"[TileMap "+this.size[0]+" cols, "+this.size[1]+" rows]"};return c}(jaws||{});"undefined"!==typeof module&&"exports"in module&&(module.exports=jaws.TileMap);
-jaws=function(c){function b(b,c){for(var f=function(c){return void 0!==b.isSpriteList?b.at(c):b[c]},g=[],j=Array(c),h=0;h<c;h++)j[h]=h;for(var h=c-1,k=b.length;0<=h;k=b.length){for(g.push(j.map(f));0<=h&&j[h]==k-1;)h--,k--;if(0<=h){j[h]+=1;for(h+=1;h<c;h++)j[h]=j[h-1]+1;h=c-1}}return g}c.collideOneWithOne=function(b,e){return b.radius&&e.radius&&b!==e&&c.collideCircles(b,e)||b.rect&&e.rect&&b!==e&&c.collideRects(b.rect(),e.rect())?!0:!1};c.collideOneWithMany=function(b,e){return e.filter(function(e){return c.collideOneWithOne(b,
+jaws=function(c){function b(b,c){for(var f=function(c){return b.isSpriteList!==void 0?b.at(c):b[c]},g=[],j=Array(c),h=0;h<c;h++)j[h]=h;for(var h=c-1,k=b.length;0<=h;k=b.length){for(g.push(j.map(f));0<=h&&j[h]==k-1;){h--;k--}if(0<=h){j[h]=j[h]+1;for(h=h+1;h<c;h++)j[h]=j[h-1]+1;h=c-1}}return g}c.collideOneWithOne=function(b,e){return b.radius&&e.radius&&b!==e&&c.collideCircles(b,e)||b.rect&&e.rect&&b!==e&&c.collideRects(b.rect(),e.rect())?true:false};c.collideOneWithMany=function(b,e){return e.filter(function(e){return c.collideOneWithOne(b,
e)})};c.collideManyWithMany=function(d,e){var f=[];d===e?b(d,2).forEach(function(b){c.collideOneWithOne(b[0],b[1])&&f.push([b[0],b[1]])}):d.forEach(function(b){e.forEach(function(d){c.collideOneWithOne(b,d)&&f.push([b,d])})});return f};c.collideCircles=function(b,e){return c.distanceBetween(b,e)<b.radius+e.radius};c.collideRects=function(b,c){return(b.x>=c.x&&b.x<=c.right||c.x>=b.x&&c.x<=b.right)&&(b.y>=c.y&&b.y<=c.bottom||c.y>=b.y&&c.y<=b.bottom)};c.distanceBetween=function(b,c){return Math.sqrt(Math.pow(b.x-
c.x,2)+Math.pow(b.y-c.y,2))};return c}(jaws||{});
-jaws=function(c){c.gfx={};c.gfx.retroScaleImage=function(b,d){var e=c.isImage(b)?c.imageToCanvas(b):b,e=e.getContext("2d").getImageData(0,0,e.width,e.height).data,f=document.createElement("canvas");f.width=b.width*d;f.height=b.height*d;for(var g=f.getContext("2d"),j=g.createImageData(f.width,f.height),h=j.width,k=j.height,m=0;m<k;m+=1)for(var n=m*j.width,r=Math.floor(m/d)*b.width,o=0;o<h;o+=1){var p=4*(n+o),q=4*(r+Math.floor(o/d));j.data[p]=e[q];j.data[p+1]=e[q+1];j.data[p+2]=e[q+2];j.data[p+3]=e[q+
-3]}g.putImageData(j,0,0);return f};return c}(jaws||{});window.addEventListener("load",function(){if(jaws.onload)jaws.onload()},!1);
+jaws=function(c){c.gfx={};c.gfx.retroScaleImage=function(b,d){var e=c.isImage(b)?c.imageToCanvas(b):b,e=e.getContext("2d").getImageData(0,0,e.width,e.height).data,f=document.createElement("canvas");f.width=b.width*d;f.height=b.height*d;for(var g=f.getContext("2d"),j=g.createImageData(f.width,f.height),h=j.width,k=j.height,m=0;m<k;m=m+1)for(var n=m*j.width,r=Math.floor(m/d)*b.width,o=0;o<h;o=o+1){var p=(n+o)*4,q=(r+Math.floor(o/d))*4;j.data[p]=e[q];j.data[p+1]=e[q+1];j.data[p+2]=e[q+2];j.data[p+3]=
+e[q+3]}g.putImageData(j,0,0);return f};return c}(jaws||{});window.addEventListener("load",function(){if(jaws.onload)jaws.onload()},!1);
View
2  jaws.js
@@ -1870,7 +1870,7 @@ jaws.Parallax.prototype.draw = function(options) {
layer.y = -(this.camera_y / layer.damping)
while(this.repeat_x && layer.x > 0) { layer.x -= layer.width }
- while(this.repeat_y && layer.y > 0) { layer.y -= layer.width }
+ while(this.repeat_y && layer.y > 0) { layer.y -= layer.height }
while(this.repeat_x && layer.x < jaws.width) {
while(this.repeat_y && layer.y < jaws.height) {
View
2  src/parallax.js
@@ -43,7 +43,7 @@ jaws.Parallax.prototype.draw = function(options) {
layer.y = -(this.camera_y / layer.damping)
while(this.repeat_x && layer.x > 0) { layer.x -= layer.width }
- while(this.repeat_y && layer.y > 0) { layer.y -= layer.width }
+ while(this.repeat_y && layer.y > 0) { layer.y -= layer.height }
while(this.repeat_x && layer.x < jaws.width) {
while(this.repeat_y && layer.y < jaws.height) {
Something went wrong with that request. Please try again.