This is getting to be so much fun! Hope it's helpful for you guys 🔥 GET THE SOURCE FILES ►► www.patreon.com/StayAtHomeDev_ 👉🏼 FREE BASIC FPS SETUP SOURCE FILES ►► github.com/StayAtHomeDev-Git/FPS-Godot-Basic-Setup
I found a much better way to check if the player is moving get_real_velocity().length() This gets the actual velocity, not intended velocity. This works better because sometimes you want to move but you cant, like you're up against a wall or something
I just want to say to anyone that isn't sure if they want to implement this. Do it. If you're worried about time, It won't add almost any time to implement it if you do it early. It might take a bit if your code is getting confusing, but it will take you mush less time now than later when it's worse. And if you're wondering if it's really worth it, it is. It's much easier to implement new things and everything is much more organized. And if something breaks, it won't break everything else.
I was following your tutorial series up until the last video and decided a state machine was a great idea, so I implemented that last weekend :D Awesome to see your take on it and great tutorials so far!
Just finished implementing a State Machine that works differently. States are children of the State Machine, then Actions and Transitions are children of States and Decision is child of Transitions. This way can split into reusable Actions and Decisions. And also swap StateMachines realtime for different phases
@@iglobrothers645 Instead of having all the code of actions and transitions inside one state script, I split into State, Actions, Transitions and Decisions. State and Transition scripts never change, just drop them to the nodes and set the True and False states for the Transitions. Each transition should have only one decision which will return True or False. Each state can have any number of Actions, which I like to make as simple as possible for reusability.
Another way to pass the player reference programmatically is to get a single reference for it in the state machine then pass it down as a property to each state when iterating through children. Nice tutorial!
Man these videos are the best I've ever seen for Godot 4! When I updated from 3.5 to 4 I couldn't figure out anything but these videos helped so much! Hahah also I was just wondering why I was getting the red overlay and figured out it was because I didn't save the state script! I was trying to fix it for like 15 minutes.😂👍
What I don't really get is why you use the Walking state script o check if you're supposed to go to Idle manually, and also from Idle to Walking. Why not check for movement in Walking and for standing still in Idle? Wouldn't that be why we did this in the first place?
at the end my debug panel isnt updating my state, it's stuck on Idle but im not sure if my debug panel is the issue or if its my statemachine, how can i fix that?
@@tenofhearts99 I think the spazzing part, is the order of debug panel, since the video put 1, it causes spazzing you mention, I put it on 5, it's much better
hey, great tutorials. They help a ton. One question, my state isn't changing when i move. I think my _update function isn't triggering in my states. Any ideas on how to fix it? edit: make sure you have an underscore before all calls on exit(), enter(), and update(), otherwise it calls the wrong function
Hi I know this video is not very recent, but could using a singleton for player variables affect other player character variables when using it for a multiplayer game?
Can you please help with the errors? The parameter "delta" is never used in the function "physics_update()". If this is intended, prefix it with an underscore: "_delta". UNUSED_PARAMETER state.gd:16
Question: I am getting the "Invalid call. Nonexistent function 'enter' in base 'Nil'." error whenever I try to run the scene. My working theory is that CURRENT_STATE is not set to anything by default, yet the same code seems to work in the video? Please advise.
Answer: I forgot to set "Current State" In the inspector to be set to idle by default. Never used that feature before this series so no wonder I didn't know what was wrong :P
On the debug info, the state keep staying as idle if I move it. When I check the debugger, I got the warning about "State machine contains incompatible child node". I'm pretty sure I've followed the instructions, and the same people that got the problem here either got unknowingly fixed or still haven't receive any answer.
Anybody else having issues with class_name? In the "Attach Node Script" screen I don't see an option for class name. I put class_name in my script but when I inherit from state .gd it does not create the new class automatically. Do I have to enable class names in my project settings or something?
How make state for differents characters like team fortress 2 or overwatch and is it possible to not work on animation with state or it's already the case with the mesh and collision shape or it's not and 1 model with skeleton3D is needed
My state is not updating in the debug panel. I'm getting a bunch of error stating that delta is never used on the State.gd functions mostly and that "State does not exist" push warning so it looks like whatever state I'm trying to update to doesn't exist?
I am currently experiencing my state machine not transitioning states whenever I move, my script and current project settings match this one. I hope somebody has a solution, or an explanation.
I'm receiving an "invalid Call. Nonexistent function 'connection' in base 'signal' error. It looks like something is wrong with my child.transition.connection(on_child_transition) line in the State_Machine script. Anyone experience this issue and have a solution or an idea where I went wrong? I've gone back through the video twice now and my scripts appear to match up with the tutorial
Getting errors complaining about "delta" in the "_process(delta):" Reticle, in "physics_update(delta: float) -> void:" in state.gd, in " func update(delta):" in IdlePlayerState, and in func update(delta):" in WalkingPlayerState. why did this get triggered from the global?
@@patrikgranstrom7683 same, get these: W 0:00:00:0885 The parameter "delta" is never used in the function "_process()". If this is intended, prefix it with an underscore: "_delta". UNUSED_PARAMETER Reticle.gd:17 W 0:00:00:0893 The parameter "delta" is never used in the function "physics_update()". If this is intended, prefix it with an underscore: "_delta". UNUSED_PARAMETER state.gd:13 W 0:00:00:0895 The parameter "delta" is never used in the function "update()". If this is intended, prefix it with an underscore: "_delta". UNUSED_PARAMETER IdlePlayerState.gd:4 W 0:00:00:0897 The parameter "delta" is never used in the function "update()". If this is intended, prefix it with an underscore: "_delta". UNUSED_PARAMETER WalkingPlayerState.gd:5 in these Reticle.gd func _process(delta): adjust_reticle_lines() state.gd func physics_update(delta: float) -> void: pass IdePlayerState func update(delta): if Global.player.velocity.lenght() > 0.0: transition.emit("WalkingPlayerState") WalkingPlayerState func update(delta): if Global.player.velocity.lenght() == 0.0: transition.emit("IdlePlayerState") im kinda stuck..
Too little content. If you continue publishing your videos at this rate, it will be 2026 until your FPS is ready and your Godot videos are all out of date again.
I'm getting an "Invalid call. Nonexistent function 'exit' in base 'Node (IdlePlayerState)." when I walk forward, and the scene closes. I'm not sure why, I assume I missed something, or it's covered in the next video. Edit: I may have fixed the problem. At CURRENT_STATE.exit(), I put an underscore in front of exit and it works. -> CURRENT_STATE._exit().
make sure to add ".name" to the CURRENT_STATE in the debug.add_property script! EXAMPLE: #global script name here!!.debug.add_property("Current State", CURRENT_STATE.name, 4)