Phase 2 — Pickup Collect

Nicholas Lim
Jun 18, 2021

The player will have the occasional ability to quickly collect all powerups and collectibles on screen by pressing C.

Player script

The Player script has a similar cooldown effect to prevent spamming of this ability. It will notify the UI Manager to activate/deactivate a new Text element that indicates when the pickup ability is available.

When CollectPickups is called, it creates an array of Collider2D objects around the player in a 10f radius (basically all of the level). From this array, the ones tagged with “Powerup” or “Collectible” will have their ActivatePickupCollect methods called.

Powerup (and similar one on Collectible) script

Once ActivatePickupCollect is called on the powerups and collectibles, the _pickupCollectActive bool is toggled to true, and these objects will quickly move towards the player.

--

--