• 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: Character 31

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

4 ways to fix bluetooth connectivity on Windows 11
Tips

4 ways to fix bluetooth connectivity on Windows 11

August 8, 2025
How to know the computer is tracked and processed by Keylogger
Tips

How to know the computer is tracked and processed by Keylogger

August 7, 2025
Opal: Create applications who do not need to write code
Tips

Opal: Create applications who do not need to write code

August 3, 2025
How to activate a new Start menu on Windows 11
Tips

How to activate a new Start menu on Windows 11

July 29, 2025
Intellgpt: AI tool for osint and data science
Tips

Intellgpt: AI tool for osint and data science

July 28, 2025
How to create Google Ai Pro 12 months free with Indian student account
Tips

How to create Google Ai Pro 12 months free with Indian student account

July 27, 2025
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

Instructions for receiving 80GB of free data from VinaPhone from August 15

Instructions for receiving 80GB of free data from VinaPhone from August 15

August 15, 2025
Online driving exam preparation: Support theory and practice

Online driving exam preparation: Support theory and practice

August 15, 2025
How to add application to your favorite bar

How to add application to your favorite bar

August 14, 2025
Wowhay.com – The door opens the world of modern knowledge and network culture

Wowhay.com – The door opens the world of modern knowledge and network culture

August 13, 2025
Instructions for receiving 80GB of free data from VinaPhone from August 15

Instructions for receiving 80GB of free data from VinaPhone from August 15

August 15, 2025
Online driving exam preparation: Support theory and practice

Online driving exam preparation: Support theory and practice

August 15, 2025
How to add application to your favorite bar

How to add application to your favorite bar

August 14, 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

Instructions for receiving 80GB of free data from VinaPhone from August 15

Instructions for receiving 80GB of free data from VinaPhone from August 15

August 15, 2025
Online driving exam preparation: Support theory and practice

Online driving exam preparation: Support theory and practice

August 15, 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í mm88 8XBET mm88 trang chủ new88

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í mm88 8XBET mm88 trang chủ new88

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