Here is the code. I have it in different tabs and I don't know how to display the code in this manner, so I will copy and paste as best I can. Thank you in advance!
Ship Sp;
Alien Al;
ArrayList<Bullet> bList;
int bulletDelay;
void setup()
{
size(800, 600);
//smooth();
Al = new Alien();
Sp = new Ship(10);
bList = new ArrayList<Bullet>();
}
void draw()
{
float deltaX = pmouseX - Sp.centerX;
float deltaY = pmouseY - Sp.centerY;
// deltaX = Sp.easing;
//deltaY = Sp.easing;
background(0);
Sp.rotateShip(deltaX, deltaY);
Sp.displayShip();
// Sp.keyPressed();
Sp.move();
Al.displayAlien();
Al.move();
if (keyPressed)
{
Sp.speedUp();
}
else
{
Sp.slowDown();
}
bulletDelay++;
for (int i=0; i < bList.size(); i++)
{
Bullet blt = bList.get(i);
blt.drawBullet();
blt.move();
}
if (mousePressed)
{
if (bulletDelay % 40 == 0)
{
float directionX = (mouseX - Sp.centerX);
float directionY = (mouseY - Sp.centerY);
float n = directionX * directionX + directionY * directionY;
n = sqrt(n);
directionX = directionX/n;
directionY = directionY/n;
Bullet b = new Bullet(Sp.centerX, Sp.centerY, 5, directionX, directionY);
Also, if any one could direct me towards some good examples of how one might cause one object to follow another I would be extremely grateful. Not a huge deal though.