dbeef / spelunky-psp

Spelunky remake for Sony PSP.
Other
138 stars 10 forks source link

Updating rope/bomb counter, limiting spawner #97

Closed dbeef closed 3 years ago

dbeef commented 3 years ago

Still a work-in-progress since I'm not convinced upon how to achieve this - here I hard-wired BombSpawner and RopeSpawner with Inventory singleton which is specifically for main-dude - but in the end, should I care about implementing it in a generic way, if main dude is the only thing in the game that can spawn bombs and ropes?

I proposed more generic way of implementing in the comments

To be settled

Edit 1:

After getting back to this, I'm fresh with a new idea. Place bomb counter in the BombSpawner, RopeCounter in the RopeSpawner, hearts counter is already within the HitpointComponent, dollars counter will be after https://github.com/dbeef/spelunky-psp/pull/99 inside the Wallet passive item - so there's no need for the Inventory in the end, once I tangle them with the subject/observer pattern.

Once Inventory is removed, GameLoop should take the responsibility of storing main-dude state inbetween the levels, i.e by copying the amount of dollars/hearts/ropes/bombs/items.

However, I am leaving it for a future housekeeping, as the present use of Inventory inside the spawners is not inherently bad.

Edit 2:

Decided to untangle RopeSpawner/BombSpawner from Inventory in this MR.