public virtual bool spawn(Vector2[] spawnCoords)
{
maxX = spawnCoords[0].X;
minX = maxX;
maxY = spawnCoords[0].Y;
minY = maxY;
List<Segment> temp = new List<Segment>();
//checks if each coordinate valid and sets values
for (int i = 0; i < spawnCoords.Length; i++)
{
//creates segments from coordinates, connecting them together as vertices, with the last vertex connecting to the first
if (i + 1 < spawnCoords.Length)
{
temp.Add(new Segment(spawnCoords[i].X, spawnCoords[i].Y, spawnCoords[i + 1].X, spawnCoords[i + 1].Y));
}
else
{
temp.Add(new Segment(spawnCoords[i].X, spawnCoords[i].Y, spawnCoords[0].X, spawnCoords[0].Y));
}
//finds maximum x and y values
if (spawnCoords[i].X > maxX)
{
maxX = spawnCoords[i].X;
}
if (spawnCoords[i].X < minX)
{
minX = spawnCoords[i].X;
}
if (spawnCoords[i].Y > maxY)
{
maxY = spawnCoords[i].Y;
}
if (spawnCoords[i].Y < minY)
{
minY = spawnCoords[i].Y;
}
}
//checks if collision is set and intersects with any existing object (with 0 movement)
if (col && intersects(0f, "l", temp))
{
return false;
}
//if all conditions met, sets object params and returns true
isSpawned = true;
segs = new List<Segment>(temp);
loc = new Vector2[spawnCoords.Length];
Array.Copy(spawnCoords, loc, spawnCoords.Length);
return true;
}
public virtual bool ontimer() {