{"size": 2277, "ext": "js", "max_stars_repo_path": "examples/platformer/js/scratch.min.js", "max_stars_repo_name": "Hydrosaur/scratch.js", "max_stars_repo_stars_event_min_datetime": "2017-05-16T22:37:13.000Z", "max_stars_repo_stars_event_max_datetime": "2019-04-06T13:15:09.000Z", "max_issues_repo_path": "examples/platformer/js/scratch.min.js", "max_issues_repo_name": "Hydrosaur/scratch.js", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "examples/platformer/js/scratch.min.js", "max_forks_repo_name": "Hydrosaur/scratch.js", "max_forks_repo_forks_event_min_datetime": "2020-12-12T18:50:01.000Z", "max_forks_repo_forks_event_max_datetime": "2020-12-12T18:50:01.000Z"}
{"max_stars_count": 4, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 2277.0, "max_line_length": 2277, "alphanum_fraction": 0.7659200703}
function Sprite(a){if(!Scratch.images.hasOwnProperty(a))throw"Scratch.images does not contain '"+a+"'.";this.image=a,this.visible=!0,this.x=0,this.y=0,this.angle=0,this.width=document.querySelector("#images #"+this.image).naturalWidth,this.height=document.querySelector("#images #"+this.image).naturalHeight,this.draw=function(){Scratch.game.drawImage(document.querySelector("#images #"+this.image),this.x,this.y)},this.changeXBy=function(a){this.x=this.x+a,Scratch.autorender&&Scratch.render()},this.changeYBy=function(a){this.y=this.y+a,Scratch.autorender&&Scratch.render()},this.goto=function(a,b){this.x=a,this.y=b,Scratch.autorender&&Scratch.render()},this.hide=function(){this.visible=!1,Scratch.autorender&&Scratch.render()},this.show=function(){this.visible=!0,Scratch.autorender&&Scratch.render()},this.changeImage=function(a){if(!Scratch.images.hasOwnProperty(a))throw"Scratch.images does not contain '"+a+"'.";this.image=a,Scratch.autorender&&Scratch.render()},this.pointInDirection=function(a){},sprites.push(this)}var sprites=[],Scratch={targetelem:null,game:null,images:{},width:640,height:480,autorender:!0,iskeydown:[],setContext:function(a){return Scratch.targetelem=a,Scratch.game=a.getContext("2d"),Scratch.width=a.width,Scratch.height=a.height,Scratch.game.translate(a.width/2,a.height/2),a.getContext("2d")},loadImages:function(a){function d(){var e=document.createElement("IMG");e.setAttribute("id",c[b]),e.setAttribute("src",Scratch.images[c[b]]),document.getElementById("images").appendChild(e),document.getElementById(c[b]).onload=function(){b+1===c.length?a():(b++,d())}}var b=0,c=Object.keys(Scratch.images);d()},render:function(){Scratch.game.fillStyle="#FFFFFF",Scratch.game.fillRect(-Scratch.width/2,-Scratch.height/2,Scratch.width,Scratch.height),sprites.forEach(function(a){a.visible&&Scratch.game.drawImage(document.querySelector("#images #"+a.image),a.x,a.y)})},importImage:function(a,b){Scratch.images[a]=b},init:function(a){var b=document.createElement("DIV");b.setAttribute("id","images"),b.setAttribute("style","display: none"),document.body.appendChild(b),Scratch.setContext(a)}};window.addEventListener("keydown",function(a){Scratch.iskeydown[a.keyCode]=!0}),window.addEventListener("keyup",function(a){Scratch.iskeydown[a.keyCode]=!1});