I’m trying to make a scroll wheel that allows for the filtering of its content depend on what is being clicked. For example the overall of a player or there age.
Then, you can use one of these sort functions before you populate your ScrollContainer (I’m assuming that’s what you use to hold your players), e.g. by changing the sort_type variable.
# ScrollContainer.gd
extends ScrollContainer
enum SortType {
BY_AGE,
BY_OVERALL,
}
var sort_type: SortType
func populate_container() -> void:
match sort_type:
SortType.BY_AGE:
GameManager.sort_players_by_age()
SortType.BY_OVERALL:
GameManager.sort_players_by_overall()
for player: Player in GameManager.players:
# your code of populating the ScrollContainer