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

Generalize code for game resources #215

Open
SamTheBlow opened this issue Aug 18, 2024 · 0 comments
Open

Generalize code for game resources #215

SamTheBlow opened this issue Aug 18, 2024 · 0 comments
Labels
bad code Code needs refactoring enhancement New feature or request
Milestone

Comments

@SamTheBlow
Copy link
Owner

Examples of game resources: money, iron, happiness, action points, RISK cards...
These all work mostly the same way, so they should all be represented by a single class.

There are already some traces of this generalization in the code, for example with this class:

class_name ResourceCost
## Class responsible for calculating how much of given game resource
## is required for given amount of something.
var _cost_for_one: float
func _init(cost_for_one: float) -> void:
_cost_for_one = cost_for_one
func cost_fori(amount: int) -> int:
return ceili(_cost_for_one * amount)
func cost_forf(amount: float) -> float:
return _cost_for_one * amount

Once this is implemented, then we can add #150, #152 and much more

@SamTheBlow SamTheBlow added enhancement New feature or request bad code Code needs refactoring labels Aug 18, 2024
@SamTheBlow SamTheBlow added this to the 5.0 milestone Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bad code Code needs refactoring enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant