package com.ezardlabs.lostsector.objects.projectiles;

import com.ezardlabs.dethsquare.Collider;
import com.ezardlabs.dethsquare.GameObject;
import com.ezardlabs.dethsquare.Script;
import com.ezardlabs.lostsector.Game.DamageType;
import com.ezardlabs.lostsector.objects.Entity;

public class Laser extends Script {

	private final int damage;

	public Laser(int damage) {
		this.damage = damage;
	}

	@Override
	public void start() {
		gameObject.setTag("projectile");
	}

	@Override
	public void update() {
		transform.translate(gameObject.transform.scale.x * 15, 0);
		if (transform.position.x <= 0) GameObject.destroy(gameObject);
	}
	
	@Override
	public void onTriggerEnter(Collider other) {
		if (other.gameObject.getTag() != null) {
			if (other.gameObject.getTag().equals("player")) {
				//noinspection ConstantConditions
				other.gameObject.getComponentOfType(Entity.class)
								.applyDamage(damage, DamageType.NORMAL,
										transform.position);
				gameObject.removeComponent(Collider.class);
				GameObject.destroy(gameObject);
			} else if (other.gameObject.getTag().equals("solid")) {
				gameObject.removeComponent(Collider.class);
				GameObject.destroy(gameObject);
			}
		}
	}
}

@@ -634,10 +634,9 @@
 %0A%09%7D%0A
-%09
 %0A
+
 %09@Ov
@@ -733,24 +733,40 @@
 ll) %7B%0A%09%09%09if 
+(%22player%22.equals
 (other.gameO
@@ -783,24 +783,55 @@
 ag()
-.equals(%22player%22
+) %7C%7C %22cryopod%22.equals(other.gameObject.getTag()
 )) %7B
@@ -974,19 +974,9 @@
 MAL,
-%0A%09%09%09%09%09%09%09%09%09%09
+ 
 tran

Allow lasers to damage cryopods