I am having a hard time trying to figure out how to extend the creep class to add my own functions in the new javascript mmo game, Screeps -> www.screeps.com
Has anyone figured this out yet ?
Thanks
A bit of an old thread, and I am not sure if Screeps has changed since the initial query was posted, but here are my thoughts...
Why have a wrapper class?? why not extend the original / game provided Creep class ?
e.g.
Creep.prototype.myFunction = function(target){
// my logic
}
Make sure to check out the screeps inheritance structure.. (Google the screeps API and check out the 'Prototypes' section on the landing page)
This can save a lot of duplicate code, for example one declaration of an inherited function in the 'Structure' prototype may save a seperate declaration for each individual Structure sub class protocols.
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With