Making a Better 2D Movement Controller (Part 1)

  Рет қаралды 5,268

Unain

Unain

Күн бұрын

Пікірлер
@unknown1138
@unknown1138 10 ай бұрын
This seems like such a nice workflow. No strict inheritance and no spaghetti either.
@Evermus
@Evermus 4 ай бұрын
Best tutorial I've seen so far. Clean code with class for each feature. Not a total mess in the player script as we can see in other tutorials. As someone new to Godot but not to coding I'm happy to have found this video. Thanks !
@drawtheword7590
@drawtheword7590 24 күн бұрын
there are supersizing few tutorials teaching on this method of using components so thank you for your contribution to this subject
@sanslesquelette987
@sanslesquelette987 5 ай бұрын
If some people struggle to make their actual jumps animated, there is an altercation between the jump animation and the ground animation. To fix this, you have to be more precise when you want that your "ground" animations (running and idle) play. In our case, they play only when the character is on ground, so it will look like something like this : if move_direction != 0 and body.is_on_floor(): sprite.play("Run") elif move_direction == 0 and body.is_on_floor() : sprite.play("Idle_Combat") func handle_jump_animation(is_jumping:bool, is_falling:bool) -> void: if is_jumping: sprite.play("Jump") elif is_falling: sprite.play("Fall")
@CrimsonFox36
@CrimsonFox36 5 ай бұрын
You also need to add body: CharacterBody2D to the move_animation function thank you for your help.
@sanslesquelette987
@sanslesquelette987 5 ай бұрын
@@CrimsonFox36 yes exactly, thanks for your help too
@JustSteve85
@JustSteve85 6 ай бұрын
Yeah, so I did ArmA 3 editing before I started messing with Godot, and this is virtually identical to how Bohemia's scripts can be broken into small config modules that are then called to a main config module, keeping you from going through hundreds of lines of code in one big gross config. This is SUPER cool and pleases my OCD. Also, implemented directly from the video with 0 errors. Thanks so much for that.
@not-a-lot-of-options
@not-a-lot-of-options 4 ай бұрын
Put the game engine in the title...
@GoblinBoi666
@GoblinBoi666 6 ай бұрын
At 6:37 you assign the gravity component to the player, i CANT for the life of me figure out how you did that. How do you find/open that little "Nodes" option? Help lol!!
@RetroCrowDev
@RetroCrowDev 6 ай бұрын
That comes from him adding the @export in front of the line " var gravity_component: GravityComponent " and the "Nodes" option comes from the line above it, " @export_subgroup("Nodes") ". Neither of these are mandatory, it's just an easy way of referring to the gravity component. You can achieve the same thing by writing " var gravity_component = $GravityComponent ".
@kylemiller6765
@kylemiller6765 16 күн бұрын
Ive followed this tutorial twice over now and the game bricks every time. It just crashes when launched.
@srspanksalot4501
@srspanksalot4501 5 ай бұрын
I think that after the tutorial I will probably handle input within the player script and then I will use signals to connect to the other components. Directly referencing the components in the player code is kind of defeating the point of using components IMO. Yes you are breaking your code into smaller pieces, but I think godot would vastly prefer if you used signals to communicate. if I just emit a signal like "player jumped" then all of the components can deal with it from there, without my player needing to do wonder about anything.
@PandaManArchives
@PandaManArchives 3 ай бұрын
Line 10:Mixed use of tabs and spaces for indentation.
@GregX999
@GregX999 8 ай бұрын
This component system is so clean!! I'm a fan! (What font are you using in the editor? I really like how narrow it is.)
@Unain
@Unain 8 ай бұрын
Actually the editor font is default, but I use a Custom Display Scale of 0.9 so it seems smaller. You can set the Custom Display Scale in the Editor Settings. It's under Interface -> Editor -> Custom Display Scale
@eleni_stathopoulou
@eleni_stathopoulou 7 ай бұрын
My animations for jumping and falling have two frames, but it only plays the first ones. Is there a way to fix that?
@vrts
@vrts 6 ай бұрын
A few things to look at: - using a boolean to prevent additional logic from running until your animation is complete - if animationPlayer.is_playing(): return - _on_animation_player_animation_finished signal
@detriativora
@detriativora 3 ай бұрын
i have the same problem. do you already found the solution to fix that?
@RickyHartII
@RickyHartII 3 ай бұрын
I'm having issues with the movement and jump animation overriding each other. They work separately however when I use both the jump animation overrides the movement. So the jump animation works but the movement doesn't. I used print to try to debug and it is reading that its in run or idle but the animations do not play. I think this is a great concept and I think this is a high value tutorial. I'm just stuck trying to figure this out. Any help would be appreciated. I am fairly new to this but have some understanding.
@emredikmen276
@emredikmen276 10 ай бұрын
Hello Unain , would you consider shooting videos with Laravel livewire in the future for example, making a crm application
@Unain
@Unain 10 ай бұрын
Maybe in the future
@Not-YourCheese
@Not-YourCheese 10 ай бұрын
What did you mean by "so the enemy has to think for itself"? Do I have to make a basic enemy AI component, like, move right, than left, than right, than left, etc. or would I have to do something else?
@Unain
@Unain 10 ай бұрын
Yeah, you can make a component that does the thinking for the AI. So it can decide where it wants to go and then it calls the movement component to go there.
@Not-YourCheese
@Not-YourCheese 10 ай бұрын
@@Unain 👍
@Not-YourCheese
@Not-YourCheese 10 ай бұрын
@@Unain Hey, could you give me some pointers on how I should make the AI without directly giving me the code, cause I actually want to learn how to make it, and I can't figure it out for the life of me. 😕
Making a Better 2D Movement Controller (Part 2)
11:31
Unain
Рет қаралды 2,4 М.
BETTER 2D visuals in 7 EASY TIPS
10:38
MrEliptik
Рет қаралды 76 М.
Cat mode and a glass of water #family #humor #fun
00:22
Kotiki_Z
Рет қаралды 42 МЛН
To Brawl AND BEYOND!
00:51
Brawl Stars
Рет қаралды 17 МЛН
Support each other🤝
00:31
ISSEI / いっせい
Рет қаралды 81 МЛН
Godot Scripts I add to Every Game
12:34
Aarimous
Рет қаралды 56 М.
Do THIS Before You Publish Your Godot Game
3:33
StayAtHomeDev
Рет қаралды 192 М.
How To Make Cutscenes / Cinematics  - Godot 4.2 Tutorial
4:18
Crow Games
Рет қаралды 15 М.
Finite State Machines in Godot | Godot Starter Kit FSM
9:46
ForlornU
Рет қаралды 38 М.
You're not using Godot to its potential
6:12
Tienne_k
Рет қаралды 106 М.
How Games Make VFX (Demonstrated in Godot 4)
5:46
PlayWithFurcifer
Рет қаралды 367 М.
Starter state machines in Godot 4
10:58
The Shaggy Dev
Рет қаралды 71 М.
10+2 AWESOME ADDONS for GODOT 4
8:36
MrElipteach
Рет қаралды 154 М.
Every 2D Node Explained in 9 Minutes !
9:19
Lukky
Рет қаралды 387 М.
Draw fewer tiles - by using a Dual-Grid system!
6:22
jess::codes
Рет қаралды 705 М.
Cat mode and a glass of water #family #humor #fun
00:22
Kotiki_Z
Рет қаралды 42 МЛН