retrogamer4ever Posted May 29, 2013 Share Posted May 29, 2013 Hey everyone, I have been searching and searching and still can't find a good solution to this... The best answer I have come across is to just add to the prototype of an existing object the functionality I need. Then if I wanted to override something just wrap another function call around the function I want to override and just call the function then do what I need to do after it. Are there any cleaner ways to go about doing this sort without having to copy large chunks of code over and over again? Maybe perhaps Phaser already has something built in to make this easier? Another example of what I am trying or want to do would be like how in Flixel you'd have those certain functions you'd always override in a object after you'd extend it and add functionality to everything that could be re-used over and over again. If using the prototype is the only way that's cool... Just wondering. Link to comment Share on other sites More sharing options...
rich Posted May 29, 2013 Share Posted May 29, 2013 Are you using JS or TS? (it makes a big difference, it's very easy to do in TS) Link to comment Share on other sites More sharing options...
retrogamer4ever Posted May 29, 2013 Author Share Posted May 29, 2013 Javascript. Link to comment Share on other sites More sharing options...
retrogamer4ever Posted May 29, 2013 Author Share Posted May 29, 2013 Okay so I guess I should have done this to begin with... I just went and looked for a typescript example of how it extends stuff http://www.c-sharpcorner.com/UploadFile/5089e0/method-overriding-in-typescript/ not that complicated. Curious though... Are you seeing more people use Phaser with Typescript or javascript? Link to comment Share on other sites More sharing options...
Recommended Posts