377,6 → 377,8 |
public string detailText = ""; |
public int lang; |
|
public bool extraPretty = false; |
public bool showTotalOfEngery = false; |
Random rnd = new Random(); |
|
public Form1(int language) |
775,13 → 777,11 |
for (int j = 1; j < points.Length - 1; j++) |
points[j] = new PointF(enemies[towers[i].target].loc.X + notZero(towers[i].loc.X - (int)enemies[towers[i].target].loc.X) / points.Length * j + rnd.Next(-points.Length - 4, points.Length + 4), enemies[towers[i].target].loc.Y + notZero(towers[i].loc.Y - (int)enemies[towers[i].target].loc.Y) / points.Length * j + rnd.Next(-points.Length - 4, points.Length + 4)); |
g.DrawLines(new Pen(towerTypes[towers[i].type].laserColour, 3), points); |
// //impactThing |
// points = new PointF[getDist(towers[i].loc, FtoP(enemies[towers[i].target].loc)) / 50 + 3]; |
// points[0] = enemies[towers[i].target].loc; |
// points[points.Length - 1] = enemies[towers[i].target].loc; |
// for (int j = 1; j < points.Length - 1; j++) |
// points[j] = new PointF((int)enemies[towers[i].target].loc.X + rnd.Next(-(int)(enemyTypes[enemies[towers[i].target].type].img.imgs[0].Width * 0.8), (int)(enemyTypes[enemies[towers[i].target].type].img.imgs[0].Width * 0.8)), (int)enemies[towers[i].target].loc.Y + rnd.Next(-(int)(enemyTypes[enemies[towers[i].target].type].img.imgs[0].Height * 0.8), (int)(enemyTypes[enemies[towers[i].target].type].img.imgs[0].Height * 0.8))); |
// g.DrawLines(new Pen(towerTypes[towers[i].type].laserColour, 3), points); |
if (extraPretty) |
{ |
for (int j = 0; j < 3; j++) |
g.DrawLines(new Pen(towerTypes[towers[i].type].laserColour, 1), rndmisePoints(points, true)); |
} |
break; |
} |
case (2): |
793,6 → 793,11 |
for (int j = 1; j < points.Length - 1; j++) |
points[j] = new PointF(enemies[towers[i].target].loc.X + notZero(towers[i].loc.X - (int)enemies[towers[i].target].loc.X) / points.Length * j + rnd.Next(-points.Length - 4, points.Length + 4), enemies[towers[i].target].loc.Y + notZero(towers[i].loc.Y - (int)enemies[towers[i].target].loc.Y) / points.Length * j + rnd.Next(-points.Length - 4, points.Length + 4)); |
g.DrawLines(new Pen(towerTypes[towers[i].type].laserColour, 3), points); |
if (extraPretty) |
{ |
for (int j = 0; j < 3; j++) |
g.DrawLines(new Pen(towerTypes[towers[i].type].laserColour, 1), rndmisePoints(points, true)); |
} |
//furtherLasers |
for (int r = 1; r < towers[i].targets.Count; r++) |
{ |
802,7 → 807,12 |
for (int j = 1; j < points.Length - 1; j++) |
points[j] = new PointF(enemies[towers[i].targets[r]].loc.X + notZero(enemies[towers[i].targets[r - 1]].loc.X - (int)enemies[towers[i].targets[r]].loc.X) / points.Length * j + rnd.Next(-points.Length - 4, points.Length + 4), enemies[towers[i].targets[r]].loc.Y + notZero(enemies[towers[i].targets[r - 1]].loc.Y - (int)enemies[towers[i].targets[r]].loc.Y) / points.Length * j + rnd.Next(-points.Length - 4, points.Length + 4)); |
g.DrawLines(new Pen(towerTypes[towers[i].type].laserColour, 3), points); |
if (extraPretty) |
{ |
for (int j = 0; j < 3; j++) |
g.DrawLines(new Pen(towerTypes[towers[i].type].laserColour, 1), rndmisePoints(points, true)); |
} |
} |
break; |
} |
} |
852,7 → 862,7 |
StringFormat sf = new StringFormat(); |
sf.Alignment = StringAlignment.Center; |
|
//LOOSE TEXT |
// Texts |
if (lives <= 0) |
g.DrawString("You Loose!\nHAHAHA!", new Font(FontFamily.GenericMonospace, 40, FontStyle.Bold, GraphicsUnit.Pixel), new SolidBrush(controlFGColour), 250, 200, sf); |
|
859,6 → 869,10 |
if (detailText != "" && enemies.Count == 0) |
g.DrawString(textWrap(font1, detailText, 450), font1, new SolidBrush(controlFGColour), 250, 400 - TextRenderer.MeasureText(textWrap(font1, detailText, 450), font1).Height, sf); |
|
if (showTotalOfEngery) |
g.DrawString(energyTotal().ToString(), font1, new SolidBrush(controlFGColour), 10, 10); |
|
// Finals |
view.Image = (Image)img.Clone(); |
g.Dispose(); |
img.Dispose(); |
870,6 → 884,22 |
|
} |
|
public PointF[] rndmisePoints(PointF[] oldPoints, bool ignoreStartAndEnd) |
{ |
PointF[] newPoints = oldPoints; |
if (ignoreStartAndEnd) |
{ |
for (int i = 1; i < newPoints.Length - 1; i++) |
newPoints[i] = new PointF(oldPoints[i].X + (float)rnd.Next(-5, 6), oldPoints[i].Y + (float)rnd.Next(-5, 6)); |
} |
else |
{ |
for (int i = 0; i < newPoints.Length; i++) |
newPoints[i] = new PointF(oldPoints[i].X + (float)rnd.Next(-5, 6), oldPoints[i].Y + (float)rnd.Next(-5, 6)); |
} |
return newPoints; |
} |
|
public string textWrap(Font font, string textN, int width) |
{ |
string text = textN; |
999,8 → 1029,13 |
} |
else |
towers[num].targets.Clear(); |
for (int i = 0; i < enemies.Count; i++) |
int start = rnd.Next(0, enemies.Count - 1); |
int i; |
for (int inc = 0; inc < enemies.Count; inc++) |
{ |
i = inc + start; |
if (i >= enemies.Count) |
i -= enemies.Count; |
if (towerTypes[towers[num].type].laserType == 2 && towers[num].target != -1) |
res = enemies[i].loc.X >= 0 && getDist(FtoP(enemies[towers[num].targets[towers[num].targets.Count - 1]].loc), FtoP(enemies[i].loc)) <= towerTypes[towers[num].type].range && enemies[i].health > 0; |
else |
1021,6 → 1056,7 |
} |
} |
} |
// no target found |
if (towerTypes[towers[num].type].laserType != 2) |
towers[num].target = -1; |
} |
1111,6 → 1147,12 |
case Keys.F4: |
timer1.Enabled = !timer1.Enabled; |
break; |
case Keys.E: |
extraPretty = !extraPretty; |
break; |
case Keys.T: |
showTotalOfEngery = !showTotalOfEngery; |
break; |
// case Keys.S: |
// sound = !sound; |
// break; |
1166,5 → 1208,13 |
enemies[num].imgTime = 0; |
return enemyTypes[enemies[num].type].getImg(enemies[num].imgTime); |
} |
|
public double energyTotal() |
{ |
double output = 0.0; |
for (int i = 0; i < towers.Count; i++) |
output += towers[i].energy; |
return output; |
} |
} |
} |