• 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

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

How to add sliders to Facebook Stories to easily rewind videos
Tips

How to add sliders to Facebook Stories to easily rewind videos

April 21, 2026
How to change the default font on Windows 10
Tips

How to change the default font on Windows 10

April 13, 2026
5 tips for using a Browser to replace an App (helps save RAM, time and money)
Tips

5 tips for using a Browser to replace an App (helps save RAM, time and money)

April 13, 2026
How to make funny MeMe photos without Photoshop within 10 seconds
Tips

How to make funny MeMe photos without Photoshop within 10 seconds

April 11, 2026
How to quickly design your own Logo without Photoshop
Tips

How to quickly design your own Logo without Photoshop

April 10, 2026
How to convert Website into App on Windows
Tips

How to convert Website into App on Windows

April 9, 2026
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

Tips to completely turn off CAPTCHA codes on iPhone and Mac are super simple

Tips to completely turn off CAPTCHA codes on iPhone and Mac are super simple

April 25, 2026
Compare Poco X8 Pro and Poco X7 Pro: A new step for the “king” of mid-range performance

Compare Poco X8 Pro and Poco X7 Pro: A new step for the “king” of mid-range performance

April 24, 2026
How to compress online videos for free without losing quality

How to compress online videos for free without losing quality

April 24, 2026
Top 5 apps to view good days 2026 for free on iOS and Android

Top 5 apps to view good days 2026 for free on iOS and Android

April 23, 2026
Tips to completely turn off CAPTCHA codes on iPhone and Mac are super simple

Tips to completely turn off CAPTCHA codes on iPhone and Mac are super simple

April 25, 2026
Compare Poco X8 Pro and Poco X7 Pro: A new step for the “king” of mid-range performance

Compare Poco X8 Pro and Poco X7 Pro: A new step for the “king” of mid-range performance

April 24, 2026
How to compress online videos for free without losing quality

How to compress online videos for free without losing quality

April 24, 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

Tips to completely turn off CAPTCHA codes on iPhone and Mac are super simple

Tips to completely turn off CAPTCHA codes on iPhone and Mac are super simple

April 25, 2026
Compare Poco X8 Pro and Poco X7 Pro: A new step for the “king” of mid-range performance

Compare Poco X8 Pro and Poco X7 Pro: A new step for the “king” of mid-range performance

April 24, 2026
No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office

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