Enemies
Space is filled with more dangers than just rocks. In this section, you'll create an enemy spaceship that will periodically appear and shoot at the player.
Following a path
When the enemy appears, it should follow a path across the screen. To keep it from looking too repetitive, you can create multiple paths and randomly choose one when the enemy starts.
Create a new scene and add a Node
. Name it EnemyPaths
and save the scene. To draw the path, add a Path2D
node. As you saw earlier, this node allows you to draw a series of connected points. When you add the node, a new menu bar appears:

These buttons let you draw and modify the path's points. Click the one with the +
symbol to add points. Click to start the path somewhere just outside the game window (the bluish-purple rectangle), and then click a few more points to create a curve. Don't worry about making it smooth just yet:

When the enemy ship follows the path, it will not look very smooth when it hits the sharp corners. To smooth the...