–2 votes

i am pretty new with Godot and programming as whole , but i am learning.

my player go to a box, break it, then he find a gun and grabs it.... here i am able to do to the box braking thing. but i don't know how to appear the gun and grab the gun after the breaking the box.
if i am trying to be more clear.... I WANT THE GUN CHANGING ACTION LIKE "Mini Militia" GAME.....
and THANKS in advance....

in Engine by (34 points)

Please don't all caps, it might attract more attention but also will make people less likely to help.
And in general guidelines, you want your box breaking signal/action to instantiate a gun, probably an Area2D or RigidBody with a sprite attached to it.,that is your gun in the floor. Then, when your player grabs/interacts with the gun in the floor, you either despawn the gun from the floor and instance it into your player in the correct position, or reparent the gun to the player. The way to know where to place the gun is usually by having a Position2D in your player that tells you where the gun object should go.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.