Creating levels and end boss

For the boss part, I think you should have a variable, that increases by 1 each level they beat. This counter can be used to dictate things that happen, like a boss, or harder levels. It’ll be 0 at the start, and go up from there.

1 Like

Brilliant idea! This is why the community here is so helpful. It makes complete sense. Use functions to clear the screen and change up the enemies with the illusion of levels. My next hurdle will be, the best way to ‘trigger’ the function - at the moment, I’m thinking of using an ‘On Game Update 40000ms’ to have the next function triggered after 40secs for example, but then it will do that ever 40 secs which I don’t particular want - any other creative ways of doing this? Is there a way to trigger an event other than after a time period?

3 Likes

Great idea! I need to determine how to add health to a unit that decreases by 1 after each hit. Makecode Arcade is a new learning curve for me but so far i’m enjoying it!

You could trigger the new level function off of any event; one that might be helpful would be based off when a certain number of enemies are destroyed. For example, you could say ‘when a certain number of enemies have been destroyed, create a boss and stop spawning enemies; then move onto the next level when the boss is destroyed.’ This can get a bit complicated, but here’s a snippet of one approach to creating that sort of behavior:

This will create a boss after 5 enemies have been destroyed on the first level, then 15 for the next level, and so on. (I also added a lifespan to the example below so that it will destroy the boss and continue after a short time)

4 Likes

Hey Jwunderl! Thanks for the snippet of code! I had a helped! I’ve been able to set it so after 15 asteroids are destroyed, it spawns the boss. I’m going to pick your brain so see how deep it can make this little side project to go.

I’m thinking about allowing the user to select 3 different ships at the beginning of the game, essentially 3 different sprites. Is this possible? Are their any project like that at the moment where a sprite is an some form of array, the user selects that sprite that would be utilised throughout the code?

Secondly - Is there a way to put pictures or colour behind a splash screen? Normally it’s all black but I’m trying to think of a creative way to do pixel art cut scenes to see if some kind of storyline is possible. Again, thanks for the visual help with the code! Appreciate all the effort. I’ve attach my code thus for people to look at. Eventually I’ll change the sprite of the ship to an original with animation of flames coming out the back but just trying to get the mechanics working. So far it goes as far as spawning the cake (boss) but that’s it for now.

arcade-T4L-Harrier%20V2

1 Like

For selecting your ship, take a look at the Memory game in MakeCode Arcade. You can find it in the Blocks Games section.

Because it’s a rather common construction (John Park uses something similar in his racing game, too), I created an extension to simplify this. If you’re interested, then take a look at this thread for more information:

Nice work so far!

Don’t worry it’s new to me too!

for cutscenes, you could set the background image, then set long text bottom for dialogue between characters.I used this before for ending dialogue in my own game

You will find a new extension “storyboard” in /beta that allows to do full scenes, boot sequences, etc… that might help with level creation.

2 Likes

Ok actually have found it. Didn’t have the /beta in my editor. Anyone have an example on how to use the storyboard feature? AKA what it looks like in code?

Would it be possible to have an example posted on the use of this extension. I am not familiar with the terminology used for the blocks.

Really appreciate any help on this.
Thanks

I am also still looking for a tutorial on how to use the “storyboard” extension. I have scrubbed the internet and can find no reference anywhere to it. With no instructions it is hard to know were even to start.

Thanks

@Mr-Coxall what kind of game are you trying to make? in many cases you could get away with just setting different tilemaps to define your levels which might be more straightforward

I am looking to have a “splash” screen at the beginning of the game and then a menu system. Also when the game ends to have an end game scene.
The icon of storyboard seems to suggest you could do it, but as I said there is literally no documentation on how to use it. I have also never seen any code examples.

Thanks

That extension is JavaScript-only; it has blocks but they can’t be used to create scenes, just move between them.

I wrote a quick example to demonstrate how to use the extension: https://makecode.com/_6dw8sj5M5YW2

Thanks for getting back to me.
Is there some technical reason there cannot be a block to make scenes?
If there cannot be a block to make scenes, maybe there should not be any blocks at all.
The not being able to make the scene in blocks really confused me when I was trying to understand the extension.

Thanks, Patrick

I agree, we should change the description on that extension or remove the blocks. @peli thoughts on that?

The technical reason for why you can’t create scenes in blocks is because all variables are global; in JavaScript you can have local variables that aren’t shared between scenes.

For example, if you have a variable named mySprite and you use it in two different scenes you could run into situations where one scene overwrites the sprite of the other while the scene is paused. Debugging that kind of code would be pretty difficult.

Now it all makes sense, global variables.
Thanks for your help.

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