• 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 RPG] #2: Characters

AnonyViet by AnonyViet
February 1, 2023
in Tips
0

First you need to understand what an RPG is: English RPG is Role Playing Games, RPG is a game form where players will role-play the characters in the game for turn-based or real-time combat.

Join the channel Telegram of the AnonyViet 👉 Link 👈

In this part we will create a character. Accompanied by a state machine with animation tree with Godot

Before that, please download the asset for yourself.

Link

Here we will use Spritesheet.

Character

Sprite

First, we will put the character image into the Sprite as usual.

[Godot RPG]  #2: Character 29

Notice the Attribute column (Inspector)

There will be VFrames and HFrames that those of you who have done with the previous tutorial will know.

  • VFrames is the length of the Spritesheet
  • Hframes is the verticality of the Spritesheet

Here:

  • Hframes equal: 13
  • Vframes equal: 16

[Godot RPG]  #2: Character 30

After the set is complete, you will see

After setting 2, you will see the Player shrink as usual.

CollisionShape2d

Please set collisionshape as in the picture because this is a TopDown RPG game, not a game like the first Tutorial. This I will explain in a video on my channel, adjust like this because it will be more reasonable with titles. RPG game especially for objects in Godot.

[Godot RPG] #2: Characters

Animation Player

You create the Animation Player node

[Godot RPG]  #2: Character 32

Then create a new Animation that will include:

  • idle : stand still
  • run : run
  • attack : attack
  • dead : dead

Then create a new Track for yourself in animation IDLE

[Godot RPG]  #2: Character 33

Then select Sprite

[Godot RPG]  #2: Character 34

Then select Frames

[Godot RPG]  #2: Character 35

Then right-click and select Insert Key and then Insert so that it is equal to the number of Frames of Animation

[Godot RPG]  #2: Character 36

Here I will leave the photo with the number of Frames. I don’t know about other Engines but it’s like this with Godot

[Godot RPG]  #2: Character 37

Then I will Insert Key with the number of Frames

In IDLE it’s 12 so I’ll insert 12 keys

You can use the bottom bar to adjust the size

[Godot RPG]  #2: Character 38

Use the one below to adjust the track time

[Godot RPG]  #2: Character 39

So I have finished editing, you guys do the same for the other ones.

State Machine With Animation Tree

State Machine: means state machine, with state machine you can manage your actions more easily and State Machine is different from Finite Machine. In Godot, there is an AnimationTree node that makes it easier for us to implement State Machine

You guys add AnimationTree node for yourself

[Godot RPG]  #2: Character 40

Where TreeRoot chooses Nodestatemachine

Where Assgin chooses ANimationPlayer

[Godot RPG]  #2: Character 41

Then Right Click to add all the animation you just created

[Godot RPG]  #2: Character 42

Here then

Pink: Connect (arrow helps signal transmission)

Green: Clear

Purple: When this is present, Animation will run first when starting

Cam: Animation Finally just run the animation with this = Stop

[Godot RPG]  #2: Character 43

Here I will Connect IDLE with other animations

[Godot RPG]  #2: Character 44

As the picture above, Idle will connect via attack ie IDLE can transmit data through attack but cannot transmit because attack has no plan to talk to idle

[Godot RPG]  #2: Character 45

As shown in the picture above, the two sides are connected. So when we are in IDLE, press attack it will run attack and after the attack finishes it will run to idle.

Please connect with the rest. If there is a dead one, just connect from idle to it because when you die it returns idle what else :D?

[Godot RPG]  #2: Character 46

I will set start to idle so that when starting up the player will be stationary, right? so when standing still it will run animation idle. But when you first run the game, the player is standing still and running animtion run or attack.

[Godot RPG]  #2: Character 47

And assign END at dead. What do you do when you die :D.

That’s it, the animation tree is done, next is the code

CODE

Here, we will use a bit of object-oriented code.

create yourself an enum containing state machine (state machine) including IDLE,RUN,ATTACK,DEAD and 1 state variable will be equal to IDLE.

[Godot RPG]  #2: Character 48

Then next we have to define each state when acting. Here I will use match (same as case/switch) and change the name laydau Nhapvao Fort Trangthai_move

[Godot RPG]  #2: Character 49

Next I need to access AnimatinoTree to be able to run Animation and turn on the AnimationTree Then I will have the command:

[Godot RPG]  #2: Character 50

Then next I have to check if Player is stationary then it will run animation idle if not stationary ie move will run moving animation and check when player moves right it will rotate right and when player moves left then it will turn left.

[Godot RPG]  #2: Character 51

[Godot RPG]  #2: Character 52

Next I will create a Camera for easy viewing.

[Godot RPG]  #2: Character 53

Then when you move, you will see it rotate right and left to run the animation.

That’s it, see you in the next post

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

Tags: charactersGodotRPG
Previous Post

How to use DeepFace Lab to graft other people’s faces into Video

Next Post

Download ABBYY FineReader 15 Full Key – Convert images into text

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
Download ABBYY FineReader 15 Full Key – Convert images into text

Download ABBYY FineReader 15 Full Key - Convert images into text

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