Skip to content

Instantly share code, notes, and snippets.

@ericlifka
Created November 4, 2015 04:02
Show Gist options
  • Save ericlifka/b170cdb6238b7da3c6dc to your computer and use it in GitHub Desktop.
Save ericlifka/b170cdb6238b7da3c6dc to your computer and use it in GitHub Desktop.
javascript class example
function Character(x, y) {
this.movingDirection = 0;
this.movesLeft = 0;
this.x = x;
this.y = y;
}
Character.prototype = {
getX: function() {
return this.x_position;
},
setX: function(newValue) {
return x_position = newValue;
},
addX: function(newValue) {
this.x_position++;
},
/*
.... rest of methods ....
*/
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment