I need to know how to make my player shoot in a 2D top down game.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By IC_Central

I can’t find a tutorial or forum on how to make a bullet for godot 4. I haven’t used godot in a while so I’m still trying to get used to the new ways of doing things.

:bust_in_silhouette: Reply From: DevBadger10

You will have to make a Bullet scene, maybe give it a Facing variable, then depending on that variable it flips its direction. It moves and slides in that direction. It gueuefrees when it hits anything. If an enemy detects its been hit it makes its health go down. Load it as a preaload in the player script. .instantiate it. Change its Facing and X and Y with instance.x instance.y instance.facing (which whould need to be denoted with @export so it can be changed.) Do get_tree().add_child(instance) or something like that to add it to the scene.

Edit: Sorry about the typo’s but I gtg

thanks so much

IC_Central | 2023-03-28 00:12

If it’s useful, could you set it as the Correct Answer for people searching the same question?

DevBadger10 | 2023-03-28 03:03

:bust_in_silhouette: Reply From: Zylo_X

Hello :slight_smile:

you can check this link it’s to kids can code site
here is a link to make shooting projectiles for 2D top down game

https://kidscancode.org/godot_recipes/4.x/2d/2d_shooting/