Skip to content

Instantly share code, notes, and snippets.

@caubry
Last active January 3, 2016 08:29
Show Gist options
  • Select an option

  • Save caubry/8436532 to your computer and use it in GitHub Desktop.

Select an option

Save caubry/8436532 to your computer and use it in GitHub Desktop.
parseJSON = function (weaponJSON) {
var parsedJSON = JSON.parse(weaponJSON);
return parsedJSON['frames']['chaingun_impact.png']['spriteSourceSize']['x'];
};
var setup = function() {
var xmlRequest = new XMLHttpRequest();
xmlRequest.open("GET", "/media/resources/gamedev/weapon.json", true);
xmlRequest.onload = function () {
parseJSON = JSON.parse(this.responseText);
};
xmlRequest.send();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment