Making a Better 2D Movement Controller (Part 1)

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

Unain

Unain

Күн бұрын

Пікірлер
@unknown1138
@unknown1138 10 ай бұрын
This seems like such a nice workflow. No strict inheritance and no spaghetti either.
@drawtheword7590
@drawtheword7590 23 күн бұрын
there are supersizing few tutorials teaching on this method of using components so thank you for your contribution to this subject
@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 !
@JustSteve85
@JustSteve85 5 ай бұрын
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.
@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
@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 ".
@PandaManArchives
@PandaManArchives 3 ай бұрын
Line 10:Mixed use of tabs and spaces for indentation.
@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?
@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
@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.
@kylemiller6765
@kylemiller6765 15 күн бұрын
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.
@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 9 ай бұрын
@@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. 😕
@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
Making a Better 2D Movement Controller (Part 2)
11:31
Unain
Рет қаралды 2,4 М.
Godot Collision Layers and Masks… the EASY Way
13:08
Bacon and Games
Рет қаралды 11 М.
I Sent a Subscriber to Disneyland
0:27
MrBeast
Рет қаралды 104 МЛН
OCCUPIED #shortssprintbrasil
0:37
Natan por Aí
Рет қаралды 131 МЛН
Every 2D Node Explained in 9 Minutes !
9:19
Lukky
Рет қаралды 386 М.
I Made the Same Game in 8 Engines
12:34
Emeral
Рет қаралды 4,3 МЛН
How Do Game Devs NOT Overscope??
9:04
Green Light Dev
Рет қаралды 10 М.
BETTER 2D visuals in 7 EASY TIPS
10:38
MrEliptik
Рет қаралды 76 М.
What makes a good 2d platformer?
6:22
FiddleStone Games
Рет қаралды 38 М.
I Scraped the Entire Steam Catalog, Here’s the Data
11:29
Newbie Indie Game Dev
Рет қаралды 601 М.
Godot Scripts I add to Every Game
12:34
Aarimous
Рет қаралды 56 М.
Finite State Machines in Godot | Godot Starter Kit FSM
9:46
ForlornU
Рет қаралды 38 М.
Draw fewer tiles - by using a Dual-Grid system!
6:22
jess::codes
Рет қаралды 701 М.
I Made My First Game in Godot in 3 Weeks...
26:21
Jack Sather
Рет қаралды 463 М.
I Sent a Subscriber to Disneyland
0:27
MrBeast
Рет қаралды 104 МЛН