Created
August 15, 2015 13:36
-
-
Save Tim-Machine/321bc775a99d2f48edd2 to your computer and use it in GitHub Desktop.
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 MedievalSoldier(type, weapon, attack) { | |
| //properties: | |
| this.type = type; | |
| this.weapon = weapon; // some type of modifer | |
| this.damage = 5; | |
| this.level = 1; | |
| //methods: | |
| this.attack = null; | |
| } | |
| var mySolider = new MedievalSoldier("pikeman", "spear"); | |
| mysolider.protype.attack = function(){ | |
| return { | |
| damage: 5 * (this.level + this.damage); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment