Log In  


Is it possible to re-define the update function mid cart? Like, having a game over function that basically just overwrites the current update function with a new one. I know you could achieve this by just putting all the current update code in an if statement, with all the new update code in an else statement, but that could start to get messy if you want to add more statements. There will almost definetly be a better way to do this, I just want to know if this would even theoretically work.



1

Yep, and it's easy too. Just assign _update to another function without the () like
_update = update_gameover, and it'll continuously run the update_gameover() function until you change it again.


Thanks!



[Please log in to post a comment]