• 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

[Lập trình Game] Lesson 5: Programming character movements

AnonyViet by AnonyViet
February 2, 2023
in Tips
0

As you know every game has a character and most 2D games have a main character who is generally a character you control for easy understanding. Today I will guide you to create Character Movement. This article consists of 2 parts as well as 2 types of character creation. Why are there 2 parts? Because it depends on your assets because most of them have 2 types of assets, 1 is the movement in each image and the other is the movement that is all in 1 image.

Join the channel Telegram of the AnonyViet 👉 Link 👈

You need to study from lesson 0 to this lesson to understand all the instructions when Game programming with Godot Please.

And without further ado, let’s get started

Character Animation:

I will guide you to do type 1 first.

Start:

First: Delete Sprite old and created for myself AnimatedSprite

programming game character movement godot

AnimatedSprite: A node that can use multiple textures to animate

Here I guide you to use my assets and if any of your assets are different from mine but it is of the same category as below, it can be applied. It has many separate photos

Player download link

Link to download motion programming game characters

Please download it and put it in the game folder

[Lập trình Game]  Lesson 5: Programming character movements 13

Next we will create the character

You click on AnimatedSprite and change the name to Player then on the right of the Player there is a setting column in the Frames section to create a new Frame for you.

code for godot character movement

Then click on the newly created SpriteFramse will display a table (click like a tilemap).

write code for character movement

Here you can see the word default on the left, delete it and create a new animation

Click like photo to create new Animations

[Lập trình Game]  Lesson 5: Programming character movements 14

Make yourself 4 of them Idle – Run – Jump – Fall

In Idle, please drag them all in the folder

[Lập trình Game]  Lesson 5: Programming character movements 15

[Lập trình Game]  Lesson 5: Programming character movements 16

Do the same with the other parts

And in the Jump section

[Lập trình Game]  Lesson 5: Programming character movements 17

Watch out for anim8 and anim11

Anim8 is jump and anim11 is fall why? Because 8 is when you jump up and 11 is when you land, you can do the same with other assets if you don’t understand, you can inbox me or go to Group Anonyviet Community to ask.

If your character is blurred like the image from Import back to 2D pixels

[Lập trình Game]  Lesson 5: Programming character movements 18

Please change them one by one in the FIlesystem section

After editing, our character will be sharp again

[Lập trình Game]  Lesson 5: Programming character movements 19

And we’re done with Character Creation Next is Coding

And you adjust the collection for yourself

[Lập trình Game]  Lesson 5: Programming character movements 20

Game character movement code

And I will guide you to coding for Character Motion. Your game character can move according to the keys you programmed.

No part script > character

Code for me to add the following part

[Lập trình Game]  Lesson 5: Programming character movements 21

Line: 12 – 13 – 16 – 17 – 20 – 24 -25 -26- 27 – 28

And below I will explain to you

$Player: is that you call Node in the script using $ to call any Node in a Node

$Player.play(): you run the Animation you did just now

$Player.flip_h: is it helps you turn left, right if you try to remove these 2 lines and then run the game, move left + right, you will see something different than when you don’t remove these 2 lines

From line 24 > line 28 is the code that helps you to jump and still apply animations.

After running the game we will have a complete character:

[Lập trình Game]  Lesson 5: Programming the character movement 22

In the next episode, I will guide you to create friction to control your speed, when you move, you will see it running fast, so there will be 1 more friction.

The article achieved: 5/5 – (100 votes)

Tags: characterGamelậpLessonmovementsProgrammingtrình
Previous Post

Instructions to install iOS 13 on Iphone with 3uTools

Next Post

How to get free Adguard Premium Key for any device

AnonyViet

AnonyViet

Related Posts

What do you need to learn game programming? Is it difficult? How long does it take?
Tips

What do you need to learn game programming? Is it difficult? How long does it take?

June 6, 2025
Instructions for registering chatgpt team at $ 1
Tips

Instructions for registering chatgpt team at $ 1

June 5, 2025
How to engrave the right mouse menu error on Windows
Tips

How to engrave the right mouse menu error on Windows

June 5, 2025
How to create online meme photos is very easy with a few steps
Tips

How to create online meme photos is very easy with a few steps

June 5, 2025
[Godot Engine] Export to Windows, Linux, MacOS, Android
Tips

[Godot Engine] Export to Windows, Linux, MacOS, Android

June 4, 2025
[Godot RPG] #2: Character
Tips

[Godot RPG] #2: Character

June 3, 2025
Next Post
How to get free Adguard Premium Key for any device

How to get free Adguard Premium Key for any device

0 0 votes
Article Rating
Subscribe
Login
Notify of
guest

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Recent News

What do you need to learn game programming? Is it difficult? How long does it take?

What do you need to learn game programming? Is it difficult? How long does it take?

June 6, 2025
Guide to search law with AI quickly and accurately

Guide to search law with AI quickly and accurately

June 6, 2025

Bắn Cá SV388 – Cuộc Săn Thưởng Trong Đại Dương Kỳ Thú

June 5, 2025

Bắn Cá 69VN – Game Đổi Thưởng Hấp Dẫn

June 5, 2025
What do you need to learn game programming? Is it difficult? How long does it take?

What do you need to learn game programming? Is it difficult? How long does it take?

June 6, 2025
Guide to search law with AI quickly and accurately

Guide to search law with AI quickly and accurately

June 6, 2025

Bắn Cá SV388 – Cuộc Săn Thưởng Trong Đại Dương Kỳ Thú

June 5, 2025
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

What do you need to learn game programming? Is it difficult? How long does it take?

What do you need to learn game programming? Is it difficult? How long does it take?

June 6, 2025
Guide to search law with AI quickly and accurately

Guide to search law with AI quickly and accurately

June 6, 2025
  • Home
  • Home 2
  • Home 3
  • Home 4
  • Home 5
  • Home 6
  • Next Dest Page
  • Sample Page

©2024 AnonyVietFor Knowledge kqxs hôm nay xem phim miễn phí SHBET https://kubet88.yoga/ bj88

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

©2024 AnonyVietFor Knowledge kqxs hôm nay xem phim miễn phí SHBET https://kubet88.yoga/ bj88

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