Great tutorial :)
I tried the complete version and there is an error, it can't preload ressource :
var simple_audio_player = preload("res://SimpleAudioPlayer.tscn")
@TwistedTwigleg said:
(I also plan on making a video tutorial too. Any suggestions/advice for making videos would be greatly appreciated!)
About suggestions, i have only ones about code, but i'm not sure they apply as this is a tutorial.
- Manage weapons as a table and a variable in player code instead of dealing with all weapons in code.
- Each weapon would have it's own script and their own animations with common names (reload, fire, unequip).
- Weapons raycast and other fire points would be included in each separate weapon prefab.
- A variable "enabled" would let the script work or do something or nothing when weapon is disabled.
This makes things lot more easy to deal with and more expandable.
Pseudo code :
if current_Weapon != new_Weapon_choice
changeCurrentWeapon(current_Weapon, new_Weapon ) ;
#
#
func changeCurrentWeapon(current_Weapon, new_Weapon ) :
#hide mesh and enabled = false for weapon script
Player_weapons.disable(current_Weapon);
Player_weapons.enable(new_Weapon );
current_Weapon = Player_weapons.getIndexEnabledWeapon();
I prefer to have each weapon with it's own projectile prefab, each projectile prefab have it's own script instead of mixing them in the same code.
The main code is linear while it could be more modular and separate functions
func _physics_process(delta):
readInputs();
checkJump();
checkRun();
manageUI();
checkChangeGun();
It's little differences, but i find getting things very modular saves me lot of time because it's more clear and lot more easy to expand or maintain.
It's more work as you must manage more models independently like separate weapons and projectiles, separate scripts, but it's better for game projects getting complex.
I think it's perhaps better the way you coded it , linear , it's more easy for beginners to have something very linear and only one script to read and learn from.
When Godot will get C# fully supported, classes will be a huge benefit for object oriented coding.