Changing images around for better flames and explosions

This commit is contained in:
Tim Young 2018-02-20 17:10:36 -06:00
parent 4fe8c06948
commit 0ee8d41c31
5 changed files with 38 additions and 13 deletions

View File

@ -17,7 +17,7 @@ namespace EduNetworkBuilder
public DateTime NextAnimation;
int AnimationCount = 0;
int AnimationSpeed = 150; //ms between animations
int maxAnim = 6;
int maxAnim = 12;
bool erased = true;
public bool AnimationDone { get { if (AnimationCount > 0) return false; return true; } }
@ -31,17 +31,28 @@ namespace EduNetworkBuilder
case AnimationName.Fire1:
ImageStartPoint = new Point(0,0);
HowBig = new Size(100, 100);
AnimationCount = 6;
AnimationCount = 12;
maxAnim = 12;
AnimationSpeed = 100;
break;
case AnimationName.Explo1:
ImageStartPoint = new Point(0, 400);
HowBig = new Size(100, 100);
AnimationCount = 12;
maxAnim = 12;
AnimationSpeed = 100;
break;
case AnimationName.Smoke1:
ImageStartPoint = new Point(0, 100);
HowBig = new Size(100, 100);
AnimationCount = 6;
break;
case AnimationName.Spark1:
ImageStartPoint = new Point(0, 200);
HowBig = new Size(100, 100);
AnimationCount = 6;
maxAnim = 6;
break;
case AnimationName.Spark1:
ImageStartPoint = new Point(0, 300);
HowBig = new Size(100, 100);
AnimationCount = 6;
maxAnim = 6;
break;
}
NextAnimation = DateTime.UtcNow.AddMilliseconds(AnimationSpeed);
@ -51,7 +62,15 @@ namespace EduNetworkBuilder
{
if (AnimationCount < 0) return;
if (!erased) return;
Rectangle AniminSnip = new Rectangle((maxAnim - AnimationCount) * HowBig.Width, ImageStartPoint.Y, HowBig.Width, HowBig.Height);
int sx = (maxAnim - AnimationCount) * HowBig.Width;
int sy = ImageStartPoint.Y;
if(sx >= Properties.Resources.Animations.Width)
{
sy = sy + HowBig.Height;
sx = sx - Properties.Resources.Animations.Width;
}
//Console.WriteLine("Anim: x:" + sx + " y:" + sy);
Rectangle AniminSnip = new Rectangle(sx, sy, HowBig.Width, HowBig.Height);
Graphics.FromImage(TheNetworkImage).DrawImage(Properties.Resources.Animations, Where, AniminSnip, GraphicsUnit.Pixel);
myPB.Invalidate(Where);
}

View File

@ -428,7 +428,6 @@
<None Include="Resources\click.wav" />
<None Include="Resources\gpl.txt" />
<None Include="Resources\CaptionBtn.png" />
<None Include="Resources\Animations.png" />
<None Include="Resources\BurnMark.png" />
<None Include="Resources\cellphone.png" />
<None Include="Resources\Copier.png" />
@ -436,6 +435,7 @@
<None Include="Resources\ip_phone.png" />
<None Include="Resources\Laptop.png" />
<None Include="Resources\microwave.png" />
<None Include="Resources\Animations.png" />
<Content Include="Resources\NBIco.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

View File

@ -50,7 +50,7 @@ namespace EduNetworkBuilder
LockVLANsOnHost, LockNicVLAN, LockInterfaceVLAN, LockVLANNames,
DeviceIsFrozen, DeviceBlowsUpWithPower, DeviceNeedsUPS,
}
public enum AnimationName { Spark1, Fire1, Smoke1 }
public enum AnimationName { Spark1, Fire1, Smoke1, Explo1 }
public enum ContextTest { ping, arp, traceroute }
public enum NetTestVerbosity { none, basic, hints, full }
public enum LBContents { routes, messages, dhcp, puzzles }

View File

@ -987,16 +987,22 @@ namespace EduNetworkBuilder
{
Rectangle Where = new Rectangle(ItemClickedOn.myLocation().X,
ItemClickedOn.myLocation().Y - ((ItemClickedOn.Size * 2) / 3), ItemClickedOn.Size, ItemClickedOn.Size);
if(ItemClickedOn.IsBurned)
if (ItemClickedOn.IsBurned)
{
int which = GameRandomGen.Next(3);
if(which ==0)
if (which == 0)
myNetwork.AddAnimation(AnimationName.Spark1, Where);
else
myNetwork.AddAnimation(AnimationName.Smoke1, Where);
}
else
myNetwork.AddAnimation(AnimationName.Fire1, Where);
{
int which = GameRandomGen.Next(3);
if (which == 0)
myNetwork.AddAnimation(AnimationName.Explo1, Where);
else
myNetwork.AddAnimation(AnimationName.Fire1, Where);
}
ItemClickedOn.IsBurned = true;
ItemClickedOn.PowerOff = true; //It remains off.
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 216 KiB