O'Reilly logo

Scratch 2.0 Game Development HOTSHOT by Sergio van Pul, Jessica Chiang

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding enemy patterns

We will create two more enemy types that follow different attack patterns. The starfish in our first sprite are moving in a straight line one after the other. For the second enemy sprite, we will create a script that causes that enemy to spread out, making it a bit harder to avoid. For the third enemy, we will write a script that makes this enemy type a bit unpredictable, moving in a wavy pattern and turning unexpectedly.

Prepare for lift off

Before we begin scripting, we need two more enemy sprites, which we will create using the following steps:

  1. Right-click on the Starfish sprite and choose duplicate. Do this twice to create two more enemy sprites, including the enemy sprite scripts.
  2. To differentiate between the three enemy ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required