excaliburjs / Excalibur

🎮 Your friendly TypeScript 2D game engine for the web 🗡️
https://excaliburjs.com
BSD 2-Clause "Simplified" License
1.77k stars 189 forks source link

On addon remove #3143

Closed jyoung4242 closed 1 week ago

jyoung4242 commented 1 month ago

PR to add onAdd() and onRemove() methods to entities.

also tested to work with the 'add' and 'remove' event listeners as well


Okay, some issues with this...

I stopped working on it when i realized the documentation impact and my lack of competency regarding adding tests to my code submissions

What's changed: entity.ts has onAdd and onRemove methods added

entity.ts and actor.ts has modified update loops to manage these events

updated events.ts to include add and remove updated lifecycleevents.ts to include has_add and has_remove and the canRemove and canAdd interfaces

and i added some bunk testing to ActorSpec.ts, i want to apologize in advance for it....

:|

I've performed manual testing of this code

cloudflare-workers-and-pages[bot] commented 1 week ago

Deploying excaliburjs with  Cloudflare Pages  Cloudflare Pages

Latest commit: a1e216b
Status:⚡️  Build in progress...

View logs

eonarheim commented 1 week ago

@jyoung4242 Thanks again for adding this feature!