package com.ezardlabs.lostsector.objects.enemies.corpus.crewmen;

import com.ezardlabs.dethsquare.Animation;
import com.ezardlabs.dethsquare.Animation.AnimationListener;
import com.ezardlabs.dethsquare.AnimationType;
import com.ezardlabs.dethsquare.Animator;
import com.ezardlabs.dethsquare.Collider;
import com.ezardlabs.dethsquare.GameObject;
import com.ezardlabs.dethsquare.Renderer;
import com.ezardlabs.dethsquare.TextureAtlas.Sprite;
import com.ezardlabs.lostsector.objects.enemies.corpus.Crewman;
import com.ezardlabs.lostsector.objects.projectiles.Laser;

public class DeraCrewman extends Crewman {

	public DeraCrewman() {
		super("dera");
	}

	@Override
	protected Animation getShootAnimation() {
		return new Animation("shoot", new Sprite[]{ta.getSprite("shoot0"), ta.getSprite("shoot1"), ta.getSprite("shoot2"), ta.getSprite("shoot3")}, new AnimationType() {
			private long lastEnd = 0;

			@Override
			public int update(int currentFrame, int numFrames) {
				switch (currentFrame) {
					case 0:
						if (System.currentTimeMillis() - lastEnd > 2000) return 1;
						else return 0;
					case 1:
					case 2:
						return currentFrame + 1;
					case 3:
						lastEnd = System.currentTimeMillis();
						return 0;
					default:
						return 0;
				}
			}
		}, 100, new AnimationListener() {
			@Override
			public void onAnimatedStarted(Animator animator) {

			}

			@Override
			public void onFrame(Animator animator, int frameNum) {
				if (frameNum % 2 == 1) {
					GameObject
							.instantiate(new GameObject("Laser", new Renderer("images/laser.png",
									100, 100).setFlipped(gameObject.renderer.hFlipped, false), new Collider(100, 100, true), new Laser(2)),
									transform.position.offset(gameObject.renderer.hFlipped ? -12.5f : 87.5f, frameNum == 1 ? 75 : 50));
				}
			}

			@Override
			public void onAnimationFinished(Animator animator) {

			}
		});
	}
}

@@ -252,16 +252,116 @@
 imator;%0A
+import com.ezardlabs.dethsquare.AudioSource;%0Aimport com.ezardlabs.dethsquare.AudioSource.AudioClip;%0A
 import c
@@ -704,47 +704,259 @@
 n %7B%0A
-%0A%09public DeraCrewman() %7B%0A%09%09super(%22dera%22
+%09private AudioSource audio = new AudioSource();%0A%09private AudioClip shoot;%0A%0A%09public DeraCrewman() %7B%0A%09%09super(%22dera%22);%0A%09%7D%0A%0A%09@Override%0A%09public void start() %7B%0A%09%09super.start();%0A%09%09shoot = new AudioClip(%22audio/dera_shoot.ogg%22);%0A%09%09gameObject.addComponent(audio
 );%0A%09
@@ -1080,17 +1080,21 @@
 hoot0%22),
- 
+%0A%09%09%09%09
 ta.getSp
@@ -1108,17 +1108,21 @@
 hoot1%22),
- 
+%0A%09%09%09%09
 ta.getSp
@@ -1136,17 +1136,21 @@
 hoot2%22),
- 
+%0A%09%09%09%09
 ta.getSp
@@ -1810,24 +1810,16 @@
 meObject
-%0A%09%09%09%09%09%09%09
 .instant
@@ -1846,17 +1846,24 @@
 %22Laser%22,
- 
+%0A%09%09%09%09%09%09%09
 new Rend
@@ -1886,16 +1886,26 @@
 er.png%22,
+ 100, 100)
 %0A%09%09%09%09%09%09%09
@@ -1906,25 +1906,16 @@
 %09%09%09%09%09%09%09%09
-100, 100)
 .setFlip
@@ -1955,17 +1955,24 @@
  false),
- 
+%0A%09%09%09%09%09%09%09
 new Coll
@@ -2007,26 +2007,17 @@
 ser(2)),
-%0A%09%09%09%09%09%09%09%09%09
+ 
 transfor
@@ -2026,16 +2026,24 @@
 position
+%0A%09%09%09%09%09%09%09
 .offset(
@@ -2088,17 +2088,26 @@
 : 87.5f,
- 
+%0A%09%09%09%09%09%09%09%09%09
 frameNum
@@ -2125,16 +2125,41 @@
 : 50));%0A
+%09%09%09%09%09audio.play(shoot);%0A%0A
 %09%09%09%09%7D%0A%09%09

Add laser audio