engine icon indicating copy to clipboard operation
engine copied to clipboard

pc.inherits works only when constructor arguments are all the same

Open Nigh7Sh4de opened this issue 11 years ago • 3 comments

By passing the same arguments object in core_inheritance.js:58 to both the Super and Self constructor you are forcing the same arguments to be given to every constructor function in the inheritance chain.

For example: If I create a function Enemy which inherits from Entity and takes a type parameter, then when my Enemy is created, due to the way that the Entity constructor is set up, Enemy._app = type which is clearly wrong.

Instead one should be able to specify how the Super constructor gets executed (ie with what parameters\arguments)

Nigh7Sh4de avatar Apr 07 '15 23:04 Nigh7Sh4de

pc.inherits has been deprecated in favor of Object.assign

daredevildave avatar Jun 29 '18 22:06 daredevildave

Thanks for resolving this :D

Nigh7Sh4de avatar Jul 04 '18 19:07 Nigh7Sh4de

My pleasure. Sorry it took so long! :)

willeastcott avatar Jul 04 '18 21:07 willeastcott