Skip to content

Mode configured to stop playing song when mode ends but configuration is invalid #142

Closed Answered by avanwinkle
bernarma asked this question in Q&A
Discussion options

You must be logged in to vote

Or I suppose it could be like this?

var fade_out: float = settings["fade_out"] if settings.get("fade_out") else 0.0

Which would check the value regardless of type and anything falsey would fall back to 0.0. That makes two lookups on the settings dictionary, but it should work.

Too bad Godot doesn't return values in booleans, or we could do var fade_out = settings.get("fade_out") or 0.0, but that would just return true or false.

Replies: 3 comments 10 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
9 replies
@bernarma
Comment options

@bernarma
Comment options

@avanwinkle
Comment options

@avanwinkle
Comment options

Answer selected by bernarma
@bernarma
Comment options

Comment options

You must be logged in to vote
1 reply
@bernarma
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants