• Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
AnonyViet - English Version
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
No Result
View All Result
AnonyViet - English Version
No Result
View All Result

[Godot Shooter] #2: Creating characters & shooting bullets

AnonyViet by AnonyViet
June 7, 2025
in Tips
0

In this article I will guide you to create characters for shooter game with Godot.

Join the channel Telegram belong to Anonyviet 👉 Link 👈

Create character

First of all, download Art.

Link: https://opengamaeart.org/content/animated-top-down-survivor-player

AnimatedSprite

First, delete the Sprite and add yourself to the node node AnimatedSprite.[Godot Shooter]  #2: Create character & shoot bullets 25

Then create a new frame

[Godot Shooter]  #2: Creating character & shooting 26

Then add for me

3 Animation is: IDLE – Move – Shoot

Handgun – Rifle – Shotgun you can get in

[Godot Shooter]  #2: Creating character & shooting 27

Pull all 3 of them

[Godot Shooter]  #2: Creating character & shooting 28

Set collisionShape2D again.

[Godot Shooter]  #2: Creating characters & shooting 29

Code:

Next is the code. We will check if the player moves, we will run Animation Move and stand still to run Animation Idle, shoot, then run Animation Shoot.

[Godot Shooter]  #2: Create character & shoot bullets 30

Next because this is a shooter we have to let its character rotate in the direction of the mouse, we have the statement: look_at(get_global_mouse_position())

[Godot Shooter]  #2: Creating character & shooting 31

Next set the camera to look easy:

Add Camera2D node in zoom to adjust it to look easy to see.

[Godot Shooter]  #2: Create character & shoot bullets 32

Shot

Next we will create bullets to shoot piu piu

Link down: https://drive.google.com/file/d/1fr4xntr-s5qs49g5n98in3otvlvjyxan/View ?USP=sharing

Please download it.

Done then create a new sensing

The original button is Area 2D to check when the bullet collides

Collisionshape2d

Sprite

[Godot Shooter]  #2: Creating character & shooting 33

You pull the image of the bullet into Sprite

Then set Collisionshape2d

Then change the name to Bullet

[Godot Shooter]  #2: Creating character & shooting 34

Create a new script

[Godot Shooter]  #2: Create character & shoot bullets 35

Here I will add 1 function so that the bullet can spawn in some position you want and damage (damage)

func start_at(pos, dir):
position = pos
rotation = dir
velocity = Vector2(speed, 0).rotated(dir)

Position = POS: Means the position of the bullet will reject the POS

rotation = rotation of bullets

[Godot Shooter]  #2: Creating character & shooting 36

Next, you will create a function to assign the speed of the bullet so that it can fly

func _physics_process(delta):
position += velocity * delta

[Godot Shooter]  #2: Create character & shoot bullets 37

Well, remember to shoot 2 buttons Sprite and Collishape Sang horizontally if you don’t want it to shoot vertical

Then next we must check if the bullet is out of the screen, it cancel itself so that the volume will not be lag.

Then you add buttons VisibilityNotifier2d Then adjust the dog okay. Then connect the signal screen_exit (escape from the screen)

[Godot Shooter]  #2: Creating character & shooting 38

[Godot Shooter]  #2: Create character & shoot bullets 39

Then in that sentence we added the command: queue_free()

[Godot Shooter]  #2: Create character & shoot bullets 40

Then we will shoot it.

Before that, you need to have a bullet sense to be able to add it and use onReady to run, it will be loaded.

[Godot Shooter]  #2: Creating character & shooting 41

Then check if pressing the key F It will shoot

[Godot Shooter]  #2: Create character & shoot bullets 42

get_parent().add_child(b): Meaning it will take parents and add_child means adding a bullet button if there is a video, I will illustrate easier.

b.start_at(global_position,rotation) : Global_position = the position of the character, rotation is the rotating angle.

When shooting, you will see it appearing in the middle of the player, we need to adjust it out of the gun. So do the following.

You add the Position2D button and then pull it in the place you want the bullet to appear

[Godot Shooter]  #2: Creating characters & shooting bullets 43

Next, simply you just need to add $ position2d before the global_position to spawn in the above place

[Godot Shooter]  #2: Creating characters & shooting bullets 44

And if you run, you will encounter the case like photos

[Godot Shooter] #2: Creating characters & shooting bullets

And the next article will have a fix

Code Player:

extends KinematicBody2D




export var speed = 200




onready var bullet = preload("res://Canh/Bulet.tscn")

func _physics_process(delta):

look_at(get_global_mouse_position())

laydau_nhapvao(delta)




func laydau_nhapvao(delta):

var vector_dauvao = Vector2.ZERO

vector_dauvao.x = Input.get_action_strength("ui_right") - Input.get_action_strength("ui_left")

vector_dauvao.y = Input.get_action_strength("ui_down") - Input.get_action_strength("ui_up")

vector_dauvao = vector_dauvao.normalized()

if vector_dauvao != Vector2.ZERO:

$AnimatedSprite.play("move")

else:

$AnimatedSprite.play("idle")

var dichuyen = vector_dauvao * speed * delta

if Input.is_key_pressed(KEY_F):

shoot()

dichuyen = move_and_collide(dichuyen)

func shoot():

var b = bullet.instance()

get_parent().add_child(b)

b.start_at($Position2D.global_position,rotation)
Previous Post

Tải App 89Bet Để Trải Nghiệm Không Giới Hạn

Next Post

Discover the glowing effect next to the iPhone ios 18 screen

AnonyViet

AnonyViet

Related Posts

Windows 7/8.1/10 users will be upgraded to Windows 11 for free
Tips

Windows 7/8.1/10 users will be upgraded to Windows 11 for free

July 30, 2026
Instructions for receiving ChatGPT Plus for 1 month for free in 2026
Tips

Instructions for receiving ChatGPT Plus for 1 month for free in 2026

July 28, 2026
Some reasons I don’t like Windows 11
Tips

Some reasons I don’t like Windows 11

July 27, 2026
Instructions on how to get free Facebook white ticks
Tips

Instructions on how to get free Facebook white ticks

July 27, 2026
Collection of Windows 11 wallpapers for computers and phones
Tips

Collection of Windows 11 wallpapers for computers and phones

July 26, 2026
Don’t install leaked Windows 11
Tips

Don’t install leaked Windows 11

July 25, 2026
Next Post
Discover the glowing effect next to the iPhone ios 18 screen

Discover the glowing effect next to the iPhone ios 18 screen

0 0 votes
Article Rating
Subscribe
Login
Notify of
guest

guest

0 Comments
Oldest
Newest Most Voted

Recent News

Hướng dẫn dùng Uneed.vn để đánh giá kiến thức Online miễn phí cho học sinh

Hướng dẫn dùng Uneed.vn để đánh giá kiến thức Online miễn phí cho học sinh

September 22, 2026
Windows 7/8.1/10 users will be upgraded to Windows 11 for free

Windows 7/8.1/10 users will be upgraded to Windows 11 for free

July 30, 2026
Instructions for receiving the free Certified LLM Security Expert certificate

Instructions for receiving the free Certified LLM Security Expert certificate

July 30, 2026
MSI laptops are not just for gamers: Which line is suitable for students, office workers and creative people?

MSI laptops are not just for gamers: Which line is suitable for students, office workers and creative people?

July 29, 2026
Hướng dẫn dùng Uneed.vn để đánh giá kiến thức Online miễn phí cho học sinh

Hướng dẫn dùng Uneed.vn để đánh giá kiến thức Online miễn phí cho học sinh

September 22, 2026
Windows 7/8.1/10 users will be upgraded to Windows 11 for free

Windows 7/8.1/10 users will be upgraded to Windows 11 for free

July 30, 2026
Instructions for receiving the free Certified LLM Security Expert certificate

Instructions for receiving the free Certified LLM Security Expert certificate

July 30, 2026
AnonyViet - English Version

AnonyViet

AnonyViet is a website share knowledge that you have never learned in school!

We are ready to welcome your comments, as well as your articles sent to AnonyViet.

Follow Us

Contact:

Email: anonyviet.com[@]gmail.com

Main Website: https://anonyviet.com

Recent News

Hướng dẫn dùng Uneed.vn để đánh giá kiến thức Online miễn phí cho học sinh

Hướng dẫn dùng Uneed.vn để đánh giá kiến thức Online miễn phí cho học sinh

September 22, 2026
Windows 7/8.1/10 users will be upgraded to Windows 11 for free

Windows 7/8.1/10 users will be upgraded to Windows 11 for free

July 30, 2026
  • Home
  • Home 2
  • Home 3
  • Home 4
  • Home 5
  • Home 6
  • Next Dest Page
  • Sample Page

say88 tỷ lệ kèo nhà cái kèo nhà cái 5 febet

No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office

say88 tỷ lệ kèo nhà cái kèo nhà cái 5 febet

wpDiscuz
0
0
Would love your thoughts, please comment.x
()
x
| Reply