Created
November 4, 2015 04:02
-
-
Save ericlifka/b170cdb6238b7da3c6dc to your computer and use it in GitHub Desktop.
javascript class example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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