package projectile;

import End.Screen;
import End.Sprite;
import Entity.ParticleSpawner;
import Entity.Spawner;

public class myProjectile extends Projectile{
	public static final int  FIRE_RATE = 15;
	public myProjectile(int x, int y, double dir){
		super(x, y, dir);
		range = 100 + random.nextInt(70);
		damage = 20;
		sprite = Sprite.projectile;
		speed = 3;
		nx = speed * Math.cos(dir) +  random.nextDouble() - 0.5;
		ny = speed * Math.sin(dir) +  random.nextDouble() - 0.5;
	}
	public void update(){
		if(level.tileCollision((int)(x + nx), (int)(y + ny),  5,  5, 6)){
				remove();
				level.add(new ParticleSpawner((int)(x - 8), (int)(y - 8), 30, 50, level));
		}
			move();
	}
	public void render(Screen screen){
		screen.renderSprite((int)(x ) , (int)(y )  + 8, sprite);
	}
	protected void move(){
		if(!level.tileCollision((int)(x ), (int)(y ),  5,  5, 6)){
			this.x += nx;
			this.y += ny;
		}
		if(calculate() > range){
			remove();
		}
	}
	
	public Sprite getSprite(){
		return sprite;
	}
	public int getSpriteSize(){
		return sprite.SIZE;
	}
	protected double calculate(){
		distance = Math.sqrt((xOrigin - x ) * (xOrigin - x  ) + (yOrigin - y ) * (yOrigin - y ) );
		return distance;
	}
}

@@ -27,38 +27,116 @@
 ort 
-End.Screen;%0D%0Aimport End.Sprite
+java.util.ArrayList;%0D%0A%0D%0Aimport End.Screen;%0D%0Aimport End.Sprite;%0D%0Aimport Entity.Entity;%0D%0Aimport Entity.Monster
 ;%0D%0Ai
@@ -180,23 +180,23 @@
  Entity.
-Spawner
+Turrent
 ;%0D%0A%0D%0Apub
@@ -278,17 +278,17 @@
 RATE = 1
-5
+0
 ;%0D%0A%09publ
@@ -307,18 +307,24 @@
 ile(
-int x, int
+double x, double
  y, 
@@ -368,17 +368,17 @@
 range = 
-1
+2
 00 + ran
@@ -406,17 +406,17 @@
 amage = 
-2
+1
 0;%0D%0A%09%09sp
@@ -452,17 +452,17 @@
 speed = 
-3
+5
 ;%0D%0A%09%09nx 
@@ -600,24 +600,667 @@
  update()%7B%0D%0A
+%09%09//List%3CEntity%3E monster_list = level.getEntities();%0D%0A%09//%09if()%0D%0A%09%09ArrayList%3CEntity%3E asd = (ArrayList%3CEntity%3E) level.getEntities();%0D%0A%09%09for(int i = 0 ; i %3C asd.size(); i++%09)%0D%0A%09%09%09if((asd.get(i) instanceof Turrent %7C%7C asd.get(i) instanceof Monster)&& ((int)(x + nx) %3E= asd.get(i).getX())  && ((int)(x + nx) %3C= asd.get(i).getX() + 16) %0D%0A%09%09%09%09%09&& (int)(y + ny) %3E= asd.get(i).getY() - 8 && (int)(y + ny) %3C= asd.get(i).getY() + 8)%7B%0D%0A%09%09%09%09remove();%0D%0A%09%09%09%09asd.get(i).setHP(asd.get(i).getHP() - damage);%0D%0A%09%09%09%09if(asd.get(i).getHP() == 0)%7B%0D%0A%09%09%09%09%09asd.get(i).remove();%0D%0A%09%09%09%09%7D%0D%0A%09%09%09%09level.add(new ParticleSpawner((int)(x - 8), (int)(y - 8), 30, 1, level));%0D%0A%09%09%09%7D%0D%0A
 %09%09if(level.t
@@ -1398,17 +1398,16 @@
 ), 30, 5
-0
 , level)
@@ -1656,24 +1656,27 @@
 = ny;%0D%0A%09%09%7D%0D%0A
+%09%0D%0A
 %09%09if(calcula

Update myProjectile.java