Step 6

Creating a Super Food


In this step we’re going to make another new kind of food to interact with

This food will make us gain life back if we touch it!

Start by creating another new function, call it createSuperFood

We will then code this function to be just like our other two food types. Remember, if you have trouble finding any blocks, feel free to look back at the previous steps!

Add a countdown to the superFood


Now we want to add one new thing to the superFood

Unlike our other two food types, the superFood will disappear after some time, 10 seconds to be exact

Add the set block as shown. Be sure to change it to say lifespan, this will make the sprite disappear after some time. Put 10000 for 10 seconds

Make the superFood appear


The code for to make the superFood appear is also going to be a bit different

We want the superFood to only appear every 10 seconds, to do this, add the blocks shown