Pick up weapons
-
Hey love the app. Im pretty new and have a learning disability so slow to understand , im making a top down game and want to be able to pick up a weapon from the ground and wield it to use. I cannot for the life of me figure how to do this. If possible visual examples on how to achieve this would be very helpful. Thanks in advance!! 😀
-
Hey welcome to hyperPad! This is possible in quite a few ways. It really depends on your game, and how in depth you want to get.
Lets say it's a gun you want to pick up. You could place a gun in your scene, then use the "Collision Event" behaviour to check your character touches the gun.
From there you could do things like "destroy object" to destroy the gun object from the scene.Now how would you make your character have a gun?
Well you can add the "shoot with button" behaviour on the object, but have it disabled. And once you collide with the gun, enable this behaviour so it starts working.Then if you want to do things like make your character look like hes holding a gun, you could do this various ways. Easiest way is to just change the player graphic to one thats holding a gun.
@robinsonx has made a few games like this in the past, so I'm sure he has some ideas as well.
-
@Murtaza ok great thank you I'll see if I can work with the information you gave me.
Im trying to make a fallout Inspired mini rpg. So hoping to have enemy's. A small Inventory for weapons and bandages to heal. I find the creating part of the animations and map building fun but the other more complicated stuff can get frustrating. I'll figure it out eventually. -
@Anathematika Concepts seem simple in theory then snap you in half in practice. Later the things you've done already will get smoother but if you have to walk away from stuff becasue it's melting you; trust every single of one of us wen through the same things 😅. Thought it was worth mentioning you're not alone ✌️😁✌️
-
@Anathematika Welcome to hyperPad. :)
As actually mentioned, you can use Collision Event to trigger behaviors when colliding with another object. So when your player collides with a gun, you can trigger logic to:
- Remove the gun from the scene
- Make your player hold a weapon (could be a simple sprite change).
- And enable the ability for the player to shoot.
Of course, if you want more customization than what is provided, you are free to use any other behaviors than the preset ones. For example, you can use the Raycast Test behavior if you want bullets to register instantly. Or you could have a graphic of the gun be attached to the player, then you can swap the graphic or change its visibility when the player switches weapons, unequips it, etc.
Pretty much everything you can do in a 2D game is possible in hyperPad. You'd have to break big tasks into smaller steps to achieve what you want. Feel free to ask for anything specific! 👌