Permalink
Browse files

New test enemy.

Testing to see if we can properly add new enemies. Works fine. Don't
know how to rotate picture and retain transparency...too hard. Need to
ask artist to do so.
  • Loading branch information...
1 parent 7ad6e84 commit 048fc141816208b4c744933d52f33932ef55b510 @SubSage committed Mar 13, 2013
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -13,8 +13,8 @@
{
private static final int MAX_FIRE = 1500;
- private float x, y, lastX, lastY, xVel, yVel, health;
- private int height, width, alliance, pointValue;
+ protected float x, y, lastX, lastY, xVel, yVel, health;
+ protected int height, width, alliance, pointValue;
Image ship;
private Explosion exp;
private boolean exploding, pathing;
@@ -30,7 +30,7 @@
private boolean grouped;
public float relX, relY;
- private AudioManager audioManager;
+ protected AudioManager audioManager;
public Enemy(EntityManager manager, float xpos, float ypos)
{
@@ -0,0 +1,32 @@
+package org.gdc.gdcalaga;
+
+import org.gdc.gdcalaga.audio.AudioAsset;
+import org.newdawn.slick.Image;
+import org.newdawn.slick.SlickException;
+//Testing class. Making sure we can implement new enemies. Works fine
+//Just add this guy instead of Enemy and you can see it work.
+public class Enemy2 extends Enemy {
+
+ public Enemy2(EntityManager manager, float xpos, float ypos) {
+ super(manager, xpos, ypos);
+ width=73;
+ height=43;
+
+ try {
+ ship = new Image("Pics/EnemyShip2.png");
+ } catch (SlickException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ public void fire()
+ {
+ Bullet newBullet = new Bullet(entities, (int)x - width/2 + 3, (int)y +height/2 ,1 , alliance);
+ Bullet newBullet2 = new Bullet(entities, (int)x - width/2 + 3, (int)y -height/2,1 , alliance);
+ newBullet.setSpeed(-250, 0);
+ newBullet2.setSpeed(-250, 0);
+ audioManager.playSFX(AudioAsset.SFX_FIRE2);
+ }
+
+}
@@ -71,7 +71,7 @@ private void spawnEnemy(){
if(type == "block"){
float newX = curX * 400 / xCols;
float newY = curY * 620 / yRows;
- Enemy newEnemy = new Enemy(entities, newX, newY);
+ Enemy newEnemy = new Enemy2(entities, newX, newY);
newEnemy.setGroup(group, newX, newY);
newEnemy.setPath(path.copy(x + newX, y + newY));
curY++;

0 comments on commit 048fc14

Please sign in to comment.