Creating levels and end boss

You can use functions in block mode to create local variables. Here’s an example of a “more” block mode version of the above storyboard example:

With a little bit more sugar, this could work well – you could have a “register scene” block which takes a function name as a value, and automatically populates any parameters of the function with default values. Then “local handler” in the storyboard would do the same as the “on X pressed” blocks, but again take functions as arguments, perhaps passing along context arguments from the scene function.

Both of these could/should also work for functions without any arguments at all, in which case you’d just use local variables and deal with the possible conflict. Most folks already know how to name their globals to avoid conflict.

Finally, there should be a getter block to get the current scene name, so that learned can use “old style” shared/global handler blocks, with a branch at the top level: “if scene is X, then… if scene is Y, then…”. That’s how people are writing multiscene code without the storyboard extension, so supporting it would give learners a bridge.

3 Likes

Do we make so many bosses

can you show me how to do powerups and checkpoints plz