Reloading Weapons and Managing Ammo (Godot Tutorial)
HTML-код
- Опубликовано: 27 окт 2022
- Godot node essentials: gdquest.mavenseed.com/courses...
📚 THE LINKS
Download the demo project: gdquest.github.io/godot-demos...
---
👥 CREDITS
Video edited by Nesi: / nesiawesomeness
Host: @Aecert
---
💌 JOIN US
Come chat on Discord: / discord
Follow us on Twitter: / nathangdquest
---
📝 CC-BY LICENSE
This video is licensed under the CC-By 4.0 license: creativecommons.org/licenses/...
You can attribute it to "CC-By 4.0 - GDQuest and contributors - www.gdquest.com/"
Thanks for the tutorial! It seems simple enough, I look forward to when I'm making a shooting mechanic next
We need a tutorial about how to build and destroy tiles and the tiles related to the tile you destroy (like what is above it) in 2d like in terraria
Bookmark'd!
My gut feeling is that showing/hiding the bullets in the HUD would be better than instancing/freeing, but that's just a hunch.
I was thinking that too
but what happens when you get extra magazine?
Nice video, thanks for sharing
very nice mechanics i will implement in my game
Hey could you make more platformer related tutorials thanks!
Please what do you use to draw your sprite. I download Godot but i don't know what to use for sprites.
What is call deferred in godot and what are the uses
Can the ammo amount be like a 0 to 100% charge of electricity and then until a play loose the ability to recharge the power cell for phaser
Can someone please make a tutorial on script organization, and when to make new scripts?
"I have a question, I would like to know if it is possible to apply bounce to the type of projectiles you use, or would I have to use a rigid body?"
new to godot (why im watching tutorial for a concept im very familiar with). but the name "textureRects" when spoken sounds a lot like "texturex/texturecks"
Interesting take on this. I made a more intricate reload system back when I was learning Unity on Udemy, and the course itself didn't go very in-depth on the subject matter. A few months ago, I remade the system in Godot, with a few tweaks. The reloading is a bit more than what was shown here, but I did that due to bugs I was running into at the time. I also allowed for different weapon types (currently an AK and a Glock as options), with different fire rates, ammo reserves and so on using "Scriptable Objects". I'm curious to how your take would be on it to see if my code can be further refactored.
maybe somewhere left the demo because right now link doesn't work
9:25
________________________________________________________________________________________________
-var ammo_missing := max_ammo - _current_ammo-
-if reserve_ammo >= ammo_missing:-
-set_reserve_ammo(reserve_ammo - ammo_missing)-
-_current_ammo = max_ammo-
-else:-
-_current_ammo += reserve_ammo-
-set_reserve_ammo(0)-
________________________________________________________________________________________________
var transfer_amount : int = min(reserve_ammo, max_ammo - _current_ammo)
set_reserve_ammo(reserve_ammo - transfer_amount)
_current_ammo += transfer_amount
Why is _physics_process used instead of _process, is physics not used there?
My guess is to ensure the rotation of the weapon and the firing process properly at runtime at the intended FPS. I could be wrong.
I really dislike guard clauses with returns.
Would way easier to read:
If timer.is_stopped():
Do something
Also, the reloading timer could be a variable in the physics process, would save a timer node.
Same thing for shooting timer. Use physics process to check bullet delay.
This is also important if you want to fire multiple bullets per frame, is more maintainable.
Also, as other pointed out, having a bullet pool is critical with high fire rate.
The other way of doing it is to tween the clip directly.
You will see the bullets going up and you will save a few timers and code.
*Magazine. That is all.
Why no reloading when there's some ammo in a clip? That's pretty essential in FPS games.
You can reload when there's some ammo in the clip with this video's code. The only cases reloading doesn't happen are:
1. The weapon's clip is already full
2. You don't have any ammo left in the reserve
@@Gdquest so the code in this video would work for a 3D game too
pls make tutorial how to make game like a mobile legends
Haha
Start small bro
just do it ahahha
@@rekiemr4501 “just do it”
It’s really not that easy
Good luck.
😅😅😅😆😆🤮🤮🤮🤮