kaplin86 Cocrea: https://cocrea.world/@Kaplin86
This dish requires basic knowledge on how to use the dolly extension, Here is a tutorial by Jamin on how to use the Dolly extension:
How to Create a Clone with Preset Property? - Gandi IDE
Cloning is not very easy to use in Scratch, especially when you need to distinguish between multiple clones of the same sprite. In Gandi IDE, we have developed the Dolly extension to solve various problems when using clones.
This tutorial is also recommended to be made in an EMPTY project before getting added/recreated in any games.
Hey guys! Welcome to kaplin’s cooking show! Today we are making mouse-based Boss Fight Brownies (dun dun dun duuunnnn). This epicly delicious meal includes a good wave-based attack system using Dolly Clones for your boss fight… like a battle from the game Undertale.
Today’s episode is pretty interesting, where i will teach you the basics, but its up to YOU to make the rest of the battle.
- Default Scratch Block Baking Kit
- Arkos Extension Cinnamon
- Dolly Extension Dark Chocolate (Not to be confused with Witcat’s input chocolate.)
- A tad bit of creativity.
Once you have all your ingredients in your kitchen, it should look like this.
Once you have your ingredients, we can begin mixing!!!
PART 1: THE FOUNDATION
- Lets get started!
- Lets make a custom block that can clone, get the id, AND set a key all at once! Make a block named “SummonClone” with a Number/Text input. Make sure to turn on “Custom Reporter” so we can get the ID.
- Now that we have that out of the way, lets start baking for real this time! Start by changing the cloneNumber, this is a key we will use so every clone has a different one. Lets go ahead and summon a clone who’s key “number” is cloneNumber.
- Put down a set temp var with a “id of (sprite name)’s clone with key=() and value=()” block inside. fill it with this info:
- Now… about that type variable… Its actually shockingly easy now that we have the ID of the clone stored inside our temp var!!!
- Almost done with the foundations!! Lets real quickly return the id and we should be good to go!
- Lets add this small piece of code. Where the clone will hide until it is given a valid type. Since there will never be a value for the key “Kaplin’s cooking show is cool 😎”, we can wait until the clone gets a type.
- Since the SummonClone is a reporter block, we have to have a place to run it! But maybe we DONT want the id? Well we might as well just make a whole new custom block so we can run our reporter block.
- I almost forgot we have to have a hit box! This IS a mouse-based. Make a new sprite, it doesn’t matter what the costume is, but try to make it a bit small. I will use the “Heart Smile” item from the scratch library… getting rid of the smile of course. Now that should be all the silverware we need… Now add this code to your new sprite:
Start by adding a variable salt called “cloneNumber” and set it to zero inside our “Green Flag” brand bowl. That should be it for our silverware:
Add a “Set object id (id)’s key (type) to value” block and give it this information.
I know i know, its very simple, no need to thank me.
Create a local variable called “currenttimer” and you should be ready to go!
Make sure to hide your boss-battle sprite!!
We have reached a big part of the tutorial, part 1 even. The following instructions will be about a example attack.
PART 2: GUN BASED EXAMPLE ATTACK ATTACK
Hey there! So you want a example attack? Get ready for a lot of movie-like bullet dodging!
- Put a “when i receive message” bowl inside your kitchen. Add a new message, Call it “gun” or whatever you want to call it, but something along those lines. Then put a repeat mixer, then our placeholder then SummonClone. Add a time if you really want. Add the input “gun” into SummonClone.
- Lets make some visual for our fancy projectile shooting weapon. Make whatever visuals you want for it inside the costumes, but I’m going to make mine look like this:
- Inside of your “When i start as a clone” brand bowl, at the very end add a if statement so we know if its a clone with the type “gun”.
- Set the sprite to your gun sprite, and add a “go to random position” butter. Make sure to place a set variable salt for the local variable “currenttimer”, and set it to timer. That way, we know how long the clone has been existing.
- Add a “repeat until” brand mixer and put in the timer salt, some subtraction flour, and a AND egg statement. Add some “point to hitbox sprite” butter.
- Alright! Very very nice. However, you may notice that whenever the player is to the left of the gun, the gun is upside down!
- So, to make it easier, we will give the player one final warning before the bullets are shot. This can be accomplished with a wait 1 second baking timer, but I’m going to change the color of my gun and wait.
- Now, add a “set object id ___” dark chocolate after your wait baking timer. For the ID slot, put in our SummonClone custom block, putting in the value “gun_bullet”. Then, for the key put “summoner” and for the value put “my id” salt.
- Before we start working on the bullet behavior, you can add a optional sound effect or a fading effect before you delete the clone.
- Add this if statement at the end of your “when i start as a clone” brand bowl.
- Since there will never be a value for the key “Kaplin’s cooking show is cool 😎”, we can wait until the clone gets a summoner value. That way, we can easily prevent bugs.
- Lets real quickly create a bullet costume. Im just going to use the lightning sprite from the scratch library but you can draw your own.
- Set the sprite and get the summoner and put it into a temp variable salt.
- Using multiple blocks like “___ of object ___”, set direction and go to eggs, we can set the bullet to be in the exact same position and direction as its summoner.
- Alright! Add a “repeat until touching edge” brand mixer. Making the sprite move some steps every frame. I will do 20.
- Even after you have your sprite hit the edge, you may want it to move for one more frame to make it look like its going off the screen. Then delete it.
- Hmm i feel like I’m forgetting something… Aha! Of course! HP! Make a variable called “HP”. Add a if “touching hitbox” egg block, change HP Salt by negative 1, play a sound, then delete this clone.
- Go inside the sprite we made earlier that goes to the player’s mouse. Add this silverware for a simple hp system.
You can change the repeat to whatever you want, but I will go with 20. Same with the seconds, change it to whatever you want.
MAKE SURE THE VERY END OF THE GUN IS WHERE THE CENTER OF THE SPRITE IS
You can also add a warning for the player so they know where the bullets are coming from.
Make sure there is a fading effect so it looks better!
Replace the 10 with whatever number you want, its how long the gun waits after being spawned until it fires. You could even use Random Number Sprinkles to decide.
This next trick looks very complicated but is actually really simple once you break it down.
Lets break it down real quick, The Arkos cinnamon “IS” block is essentially a “if not equal to 0”.
This next block is the true magic to this area, the “Sign of” cinnamon can turn a block into -1 or 1 based on if its negative or positive.
So 5 would be 1, Negative 26 would be -1, and so on. With this, if we add a + 1 flour, every negative number will become 0, and all positive numbers can become 2!
Now that all negative numbers are 0 and all positives are 2, we can put it into the “is” cinnamon so all negative numbers are false, while all positive numbers are true. By putting in our direction salt, we can know if the direction is positive or not. Now looking back at this code you could probably do some other techniques, but its always good to try something new.
Now, by putting it into a if statement. We can tell if the direction is negative or not. If it is POSITIVE, then we use the “set the vertical scaling of the sprite to 1 (times)” cinnamon from Arkos cinnamon. This way, if its positive it will revert back to normal. If the direction is negative, we set the vertical scaling to -1 to vertically flip the sprite. That makes it look like this:
Looks much much better. Wowie that was a long step lets continue.
All code here will be executed from a clone labeled “gun_bullet”.
Now enjoy this freshly made, singular Boss Fight Brownie. Now its your turn! Make your own attack patterns using the tricks i have shown! I would LOVE to see them!! Post them inside the tutorial channel on the discord server you found this tutorial in.
Make sure to send this cooking guide to all your scratch friends (if you want)!!!!!
GOOD THINGS TO CHANGE
Some good things you can change to fit your project:
- More attacks. This should be pretty obvious, but using the custom blocks and techniques i have shown, you should be able to easily make more attacks.
- Better visuals. Whats a good boss fight without a good background? What about animated attacks? You choose.
- Music. Music based attacks? Attacks timed to the music? Yes please! I may make a tutorial soon on how to make proper music-timed attacks using a technique i learned.
- Breaking The Mold. What about a attack where your hitbox stops following the mouse on the Y and falls down to gravity? Then you have to click to jump! You can take this however far you want.
- Theming. This is kinda the same as visuals, but you should try to make a theme to all your boss fights attacks! Maybe the boss is the shadow knight, then you would want royal/medieval music alongside sword attacks. Or maybe your fighting Mr. Sellington and his money symbol attacks.
- Fermi Extension. Using the fermi extension, you can set the max number of clones to whatever you want!
Lazy? Here is a link to the project shown so you can remix it
Boss Fight Brownies tutorial by @Kaplin86 /Scratch project hosted on Cocrea.
how did you find this exactly? Hosted on Cocrea.world, powered by Gandi IDE.
I will be updating it to have new attacks!