Friday, June 21, 2024

Godot - Self learn Godot Journal / 自学Godot日记

Since PC struggles to run UE5.

Why not learn Godot?

Let's the Godot journey begins.

Have fun.

UE5 - Stop learning temporary due to hardware struggles to run UE5 / 由于硬件难以运行UE5而暂时停止学习

 Continue to learn UE5 again when have better PC.

Stop at 2024 June 22.

UE5 - 0006 - How to create movable player from scratch / 如何从头开始创建可移动的玩家

Source learn from https://youtu.be/Tf4rpJfOy54?si=IuD-Q9hpoXZbu_H0

Open "Content Browser", create "Blueprint Class".

Choose "Game Mode Base" to create a blueprint class.

Rename the 1st blueprint class to any name you wanted. 
And create second "Blueprint Class" again.

Choose "Character" for 2nd blueprint class.

Rename 2nd blueprint class to any name you like. And leave it there for now.

Now, assign movement to Keyboard at "Project Settings".

Go to "Input" > Axis Mapping" & add each key for each different movement.

Add keyboard one by one according to the picture.

Adjust "Scale" accordingly. (Test each key when assigned. If any key movement is in reversed, change Scale accordingly.)

Double click "Character Blueprint Class"

Go to "Event Graph"

In Event Graph. Delete everything.

Right click in empty space and search for word accordingly in the image.

Follow image 



Search "Get Actor Forward Vector" & connect to World Direction

Do for Strafe Left Right according to the image.

2 keys done.

Highlight both groups and give it a Description about what it is.

Change background color of the comment box.


After setting up. "Compile" & "Save" always.

Back to the "Level" scene.

Drag & Drop the "Character Blueprint Class" into the level.

Go to World Setting. Change the settings accordingly.

World setting. Choose the customized blueprint class accordingly into the settings.

After setup world settings. Go to "Details" setting, Pawn > Auto Possess Player > Player 0. 


Now back to "Character Blueprint Class" for "Mouse" movement.
Setup accordingly to the image.

After "Compile" & "Save". Test the game. If the direction is moving opposite, go to Project Setting > Input> Axis > Scale to adjust positive or negative value to the right direction.

Back to Character Event Graph for Jump Event (Space bar)

Create "Variable" for easier access to adjust the value for later stage. 

Give it a name & choose "Float" as class.

Choose Variable > Compile first before you can adjust the value in the Details.
Adjust the value in number.4.
And Drag & Drop the Variable into the Event Graph

Choose Get.

Search the keyword according to the image. Get first, Set second.

Jump event overall setup.

For Run event.

Check the Default character movement.
So that, can setup higher walking speed for RUN.

Search keywords accordingly. Untick Context Sensitive to unhide some hidden extra actions.

Create a new Variable for Run again. Repeat the process just like Jump Event.

Sometime the Actions need Target to something. So Character needs to have the Run event.
Hold Control & Click the Character Movement, & Drag & Drop to the Event Graph.

Compile first & access to Details setting. Adjust the speed faster than Default Walking Speed.

After the release the Run key. Adjust the Speed back to Walking Speed.

Crouch Event. Check the Default Crouch Value in Details Setting.

Again. Create a new Variable for customized Crouch Value.

Drag & drop Crouch Variable into Event Graph. Choose Get.

Search keyword accordingly in the image.

Crouch Event overview.

All Events overview. 

Benefits of using Variable. Turn the EYES on in Variable. Therefore, user can adjust the variable value at the Editor without going into Event Graph.

Compile & Save always.

Back to Level scene. Choose Character in the Outliner. User can adjust the Variable in at the Editor.

Save & Run the game. Now the character can move accordingly.

The End.