Jump to content

Newb js question, how to extend or override stuff in Phaser


retrogamer4ever
 Share

Recommended Posts

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

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

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...