|Please expand this article or section. You can help by talk page. (November 2019)if you are an editor. More information might be found in a section of the|
This article is about creating a final boss sprite. This sprite can be used in any type of game, but this article is going to be focusing on making a final boss sprite in a platformer. For instructions on how to make a platformer, see How to Make a Basic Platformer.
Creating the Boss Sprite
The boss sprite is the character controlled by the computer. This means that the code will have to tell it to do things all by itself at certain times.
This first script will make it so when the player sprite touches it, the game will end.
when green flag clicked forever if <touching (Player v)?> then // The player broadcast (Game Over v) // Optional, if the game has a Game Over screen. stop [all v]
|Note:||The Stop all block can substituted with any sort of event that would occur when the player gets hit by the boss.|
Making the Boss Sprite Move
For this final boss sprite, the sprite will go in a random direction, and bounce off the walls.
when green flag clicked point in direction  forever move  steps if on edge, bounce
Making the Boss Sprite Shoot Projectiles
This script will allow the boss sprite to shoot projectiles. Create a new sprite for the ammo. This will be what the boss sprite will shoot at the player. Add the following script to the ammo sprite.
when green flag clicked go to (Boss v) // The boss sprite hide // Hidden so it can't be seen when the boss sprite isn't shooting.
Next, to make the ammo sprite and the boss sprite compatible add the following script to the boss sprite.
when green flag clicked forever wait (pick random (1) to (5)) seconds broadcast (fire v) and wait
Go back to the ammo sprite. The ammo sprite needs to go towards the player when the boss sprite fires.
when I receive [fire v] show go to (Boss v) // The boss sprite repeat until <<touching (Player v)?> or <touching (edge v)?> move  steps hide end
Now, to make the game end if the ammo sprite touches the player, add this to the ammo sprite.
when green flag clicked forever If <touching (Player v)?> then stop [all v]