ADDING A NEW ENEMY
Copy The Evil Square Tab
Let's get started by making a new tab for your new class. Think about a good, descriptive name for your enemy. In our example, we'll call it BadCircle. Do not use that name; use a good and descriptive name for your enemy! Copy the code from EvilSquare to this tab.
Go through the code and change all the names. You'll need to change code both in this new tab and in values. There should only be references to this new class's name.
Make sure all the images from Piskel are in your project's data folder. You can check your folder by pressing CTRL-K, or looking on the menu bar for Sketch --> Show Sketch Folder.
In the media tab, you'll need to both declare and initialize the new PImage.
Go to your main tab and look at the code we used to add EvilSquares. You can do the same for your new enemy type!
Making a Projectile with Parameters
Create a new projectile class in the Projectiles tab.
Give it a name and images as you desire. You can use the RedShot projectile as a reference for enemies, and PlayerShotBasic for the player.
Modify the constructor:
It should take two additional parameters, xSpeed and ySpeed
It should pass those values on using the last two parameters of the super() call
In your enemy when you create a bullet, provide it with two additional parameters. For instance, an enemy that makes FancyShots that move diagonally down/left and down/right would be:
Take a moment to think about each shot's starting starting x and y coordinates. Do you want it coming from the center of the enemy? Left? Right?
For small enemies with fast shots, it's hard to tell. But for big enemies it may make a difference.
ATTACK AND MOVE STYLE IDEAS
Edge of Screen
★ Bounce off the edges of the screen
★ Wrap from one side of the screen to another
★★ Hug the edges of the screen by turning left at each side