Tutorial: How to create a player controller using a STATE MACHINE in Godot 3.4

Tutorial: How to create a player controller using a STATE MACHINE in Godot 3.4

Slick Games

2 года назад

14,106 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@suiyubanbo
@suiyubanbo - 11.11.2023 10:58

HI,Why doesn't state_machine(state.gd) and state(StateMachine.gd) create a circular dependency, and how efficient is it to do so?

Ответить
@Dragon20C
@Dragon20C - 22.05.2023 21:49

I got a quick question, I find my self in a unique situation, so lets say I have a idle, walk, sprint and jump states and I am currently implementing a crouch state, I have noticed that it will become messy since in my crouch state I want it to walk and sometimes go to idle, So I was thinking would it be possiable to have a state machine inside a state machine, so that the whole main state machine will see that I am in a crouched state machine but if I press a button say to sprint the main state machine should restart the crouch state machine and change normally to the sprint state, I hope I explained it well lol.

Ответить
@TheBoxingBinge
@TheBoxingBinge - 14.05.2023 17:19

Does this also work in godot4?

Ответить
@RetroMoi
@RetroMoi - 01.05.2023 03:57

Thanks for the tutorial! Any plans to release a version for Godot 4?

Ответить
@timbob1301
@timbob1301 - 10.04.2023 19:16

Very nice tutorial, thank you! One question: What is the best way to bring states into this pattern that are triggered from outside like being hit? For example I have a hit-state and being hit is triggered by a mob which calls a hurt() function on my player. Should I then call transition_to("Hit") from my player or is there a better way? Feels a bit like breaking the pattern if I call transition_to() from the player script. Thanks in advance!

Ответить
@firzijuanda3583
@firzijuanda3583 - 29.03.2023 03:21

I've followed the tutorial and I found a problem where when I run to the void when I hold down the right button they still play a walking animation in the air

Ответить
@ceopotato5712
@ceopotato5712 - 27.03.2023 12:57

THANKS!!!!

Ответить
@ceow3200
@ceow3200 - 12.02.2023 21:56

I'm using Godot 0.4 and the "if not is_zero_approx(player.get_input_direction()):" within the 'Air' state keeps returning "invalid call. Nonexistent function 'get_input_direction' in base 'Nil'" is there a possible fix?

Ответить
@hectorpereira2803
@hectorpereira2803 - 11.02.2023 11:44

great tutorial

Ответить
@Betegfos
@Betegfos - 23.01.2023 02:19

Can you show this method for a 3D character as well?

Ответить
@worldrootgames
@worldrootgames - 03.01.2023 04:03

I'm getting a error "Trying to assign value of type 'Node' to a variable of type 'AnimationPlayer'" on onready var animation_player:AnimationPlayer = get_node(_animation_player)

Ответить
@SprachlosGaming
@SprachlosGaming - 26.12.2022 20:56

for some reason my player will only jump one time if i have either direction held. for example i have 'move_right' held char moves right, i press jump and he jumps while moving. he lands and continues to move but he will not be able to jump until i release that direction. any ideas why?

Ответить
@TabooZombie
@TabooZombie - 11.12.2022 18:24

Now how would you implement coyote time in a state machine??

Ответить
@Guitarboredguy
@Guitarboredguy - 05.12.2022 16:45

Perfect. I was struggling a little bit with the GDQuest version of this tutorial, but this video answered all the questions I had. Nice one!

Ответить
@xdfabianmuratixd2201
@xdfabianmuratixd2201 - 20.11.2022 05:39

<3

Ответить
@DoctorMandible
@DoctorMandible - 20.10.2022 19:35

DRY that code out. Move those repeated physics checks into the player node.

Ответить
@PeKlim
@PeKlim - 17.10.2022 10:35

You tell what we do, not why we do it. Not so informative as I hoped for.

Ответить
@ironfn
@ironfn - 09.10.2022 15:03

You're awesome!

Ответить
@TheSpeedyBoi
@TheSpeedyBoi - 29.09.2022 05:14

its concise, but because of that it had my brain hurting from the amount of pausing and copy/pasting there was. But yeah AT LEAST IT WORKS

Ответить
@freiaz494
@freiaz494 - 18.08.2022 08:52

I just have 1 question, how do I re-use the state machine for multiple payable characters?

Ответить
@gera8428
@gera8428 - 16.08.2022 08:32

How do you transition state when area entered? Cannot use state_machine.transition_to since state isnt declared. I would appreciate if you could help me with that.

Ответить
@developspinrolespinroledev4046
@developspinrolespinroledev4046 - 25.07.2022 14:33

Oh , GOD !!!! Thx you so much !!!! Your vid made me know more about player state machine !!! THXXXXX !!!

Ответить
@gera8428
@gera8428 - 19.07.2022 11:39

Thank you for the great tutorial! I would appreciate if you could tell me how to implement fall and double jump state. Thanks.

Ответить
@megasman9166
@megasman9166 - 16.07.2022 16:13

went from shaggydev to gdquest to you and now im starting to understand how implementation was used i just have to wrap my brain around a multiple attack but im guessing jus like animationtree ending the combat mechnaic with state.idle is better approach

Ответить
@jugibur2117
@jugibur2117 - 01.07.2022 13:32

Great tutorial, thanks!

Ответить
@guydadon14
@guydadon14 - 27.06.2022 13:14

straight to the point, gold star! great tutorial!

Ответить
@laguaridadesyx
@laguaridadesyx - 23.06.2022 23:11

Assertion failed.

that happens everytime i start to debug.

edit: fixed it lol, tunrs out i also had to assign the player script to the one in the level scene.

Great video btw, im subscribed now

Ответить
@JWEthan
@JWEthan - 20.06.2022 13:55

Lovely explanation. Concise and easy to understand.

Ответить
@shahnet2201
@shahnet2201 - 14.06.2022 13:16

thanks

Ответить
@mohamedmoh5789
@mohamedmoh5789 - 10.06.2022 15:19

I've been waiting for this tutorial, thank you very much

Ответить
@markthompson403
@markthompson403 - 09.06.2022 16:10

Great tutorial, but I'm not sure I follow why you have exported the animation player in the states? All three states use the same animation player?

Ответить
@andreamassa2176
@andreamassa2176 - 09.06.2022 09:24

Nice tutorial. Thank you for sharing!!

Ответить
@markbrouwers8043
@markbrouwers8043 - 09.06.2022 01:26

Very concise tutorial, thank you very much!

Ответить