How would i go about checking if a function was called? I have created a function to see if the level was completed like so:
func levelOneCompleted(){
}
When the level one is beat, i call the function levelOneCompleted().
The scene then goes to another scene. It's at this scene that i want to check if the function was called. I am thinking i can make some kind of "if statement".
if levelOneCompleted is called {
//do this
else{
//do this
}
What would be the best way of going about this?
Set a boolean flag to true
inside levelOneCompleted()
:
var isLevelOneCompleted = false
func levelOneCompleted(){
// do things...
isLevelOneCompleted = true
}
And later...
if isLevelOneCompleted {
//do this
} else {
//do this
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With