Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converting to C# #3

Open
art7pro opened this issue Dec 3, 2023 · 0 comments
Open

Converting to C# #3

art7pro opened this issue Dec 3, 2023 · 0 comments

Comments

@art7pro
Copy link

art7pro commented Dec 3, 2023

Hello everybody, good day, Johnny. I learn about the Godot engine and convert Your TPC and TPS projects to C#. My conversion of your Third Person Controller project was complete. There is an issue with TPS script WeaponStats.gd that I need to fix. Please help me. How can I convert this lines from Gdscript to C#?

func mag_decrement():
	weapon_stats[weapon_name()]["mag"] -= 1

func mag_fill():
	var empty_space = mag_size() - mag()
	weapon_stats[weapon_name()]["mag"] += min(empty_space, ammo_backup())
	weapon_stats[weapon_name()]["ammo_backup"] -= min(empty_space, ammo_backup())

func ammo_refill(ammo_type):
	weapon_stats[ammo_type]["ammo_backup"] = weapon_stats[ammo_type]["ammo_backup_max"]
	weapon_stats[ammo_type]["mag"] = weapon_stats[ammo_type]["mag_size"]


# getters

func weapon_name():
	return player.weapons[player.current_weapon]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant