Creating attack pattern 1

To make this fight more interesting, let's start writing the attack patterns.

Prepare for lift off

The thing with attack patterns is figuring out an interesting movement pattern first and then finding a way to create a script that moves the sprite according to that pattern. For this game, we will create three very distinct movement patterns.

The first one will be to move the boss in a pattern similar to the number 8. The number 8 will be lying horizontally, so the boss sprite will appear to be bobbing back and forth and weaving around the player character.

Prepare for lift off

Engage thrusters

We will start this pattern when the correct message is called. Since this is the first pattern that we make, we have named it pattern1.

  1. We add a new script starting with when I receive <pattern1>.
  2. Then we use set rotation style <all around> so that the sprite can move about freely and make loops as it goes.
  3. We move the sprite to the center of the screen with glide 1 secs to x: () y: (); fill in the values as 0 and 0 respectively.
  4. Then we point the sprite using point in direction () with value -135. This points it to the bottom-left.
  5. We add a fixed repeat () loop to repeat the pattern, which is shown in the screenshot number 8, four times.
  6. Inside this loop are four more repeat loops that describe each part of the complete pattern.
  7. With the first one, we repeat 20 times (using repeat) to move speed steps. This moves the sprite in a straight line towards the bottom-left.
  8. Then we start turning around in a circle. We use repeat () / turnStep times with value 270.
  9. At each step, we make the sprite turn clockwise using turn <clockwise> turnStep degrees.
  10. We also use move speed steps to move the sprite in a circle, instead of around its own center point.
  11. After this, it's back to a straight line. We can duplicate the earlier script component for this (using duplicate) as it works in exactly the same way. Since the sprite has rotated, it will now move in the bottom-right direction.
  12. Finally, we make another turn. This is very similar to the first turn, so we can also use duplicate to make a copy of this script.
  13. In this case, we have the sprite move counterclockwise. So, we replace the turn <clockwise> block with the turn <counterclockwise> block. That finishes a complete figure-8 move.
    Engage thrusters
  14. Once that has been repeated four times, we will pick another random pattern. It might pick the pattern that is shown in the scrrenshot number 8 again, or it could be one of the other two patterns that we will write next.
  15. To finish the script, we duplicate the broadcast attack pattern's message construction from the boss message script.

Objective complete – mini debriefing

Creating movement patterns requires a bit of planning. First, we have to think about what would be an interesting move to make. Then, we have to figure out a way to turn that pattern into a script. This often requires some calculation and experimentation.

Since these scripts stand on their own and don't influence other scripts directly, you can't really break anything. Don't be afraid to try a few things when designing something like this. It often takes several tries before you get the result that you want.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.37.196