Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

How to make a 2D Pickup system like guns and stuff thanks 

Good question!

Without knowing what system you are using, I'll speak in generalities using an example. Pick-ups are little more than pretty event triggers for doing some mechanic in the game (add points to a score, increase health, add or switch a weapon, replenish bullets, increment a goal object number, etc...)

Let's assume you want to have a pick-up item for a shotgun. Let's also assume that picking up a new weapon occurs when you walk into a floating pick-up icon of that item. Upon triggering the pick-up, it immediately adds the new weapon to your player's weapon inventory and switches to that weapon.

First, implement the shotgun mechanic, the inventory system, and the ability to switch weapons.

Next, create your pick-up indicator (like a floating icon image of the shotgun). Add a collision box to the icon and place it in the level. Setup a trigger so that when someone collides with the pick-up, it will:
 - 1) check to see if the weapon is already in your inventory
 - 2) if not, add the weapon to your inventory
 - 3) switch to the newly added weapon
 - 4) delete the pick-up (unless you want it to remain, like a health/bullet recharge station or save point)

Pick-ups are ideal items to make as a one generic thing with a variable or flag that sets which item it is a pick-up for. (Just check your flag to set which icon/sprite to use.)

ENGINE SPECIFIC IMPLEMENTATION:
Unity: Here's an example of implementing this in Unity:


GameMaker: Here's an example of implementing this in GameMaker:

Godot, use an Area2D that triggers on player enter.  Here's a pick-up tutorial for Godot:

WoW thank you so much i looked into all you said and i have to say thank you SO MUCH