Game Development Reference
In-Depth Information
4. Since the patern has to be a random choice between three opions, we create an
assembled script block based on the atack patern list and a random number.
5. In any case, we use
broadcast ()
to send a message.
6. The empty space should be filled with
item () of <atack paterns>
.
7.
To pick the item from the list, we use
pick random () to ()
; fill in the values
1
and
3
respecively.
8. This will trigger the irst random atack patern to start.
9. We then start a condiion loop to check whether the boss has been defeated yet.
10. Atach a
repeat unil ()
block.
11. The condiion to check for will be
if hitCount = ()
with value
50
. (This number can
be changed to make it easier/harder to defeat the boss.)
12. Inside the loop, while the enemy hasn't been defeated yet, we will check if it
touches the spear sprite using
touching spear
. Technically, this will be a clone
of the spear sprite but for the script that doesn't make a difference.
13. When an enemy is hit by a
spear
sprite, we will use
change <hitCount> by ()
with value
1
.
Remember how we created an upgraded spear, but didn't actually do anything with it?
Let's change that here:
1. We add another check inside the
touching
check, which is an
if () else ()
block
in this case.
2. Here we check whether the enemy touches the gray color using
touching color
<gray>
. This refers to the light gray ip of the upgraded spear.
3. If so, we use
set speed to ()
with value
4
to temporarily slow down the enemy
when hit.
4. If the color is something else, that is to say, not the upgraded spear, we use
set
speed to ()
with value
6
.
5. To allow some ime between hit checks, we wait for
0.01
seconds using
wait ()
seconds
before running the enire loop again.