Skip to content

Instantly share code, notes, and snippets.

@ScottLilly
Created February 23, 2018 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ScottLilly/e47365a4ea2cc62e132315e2e10af1e0 to your computer and use it in GitHub Desktop.
Save ScottLilly/e47365a4ea2cc62e132315e2e10af1e0 to your computer and use it in GitHub Desktop.
ForgottenLand location images
using System.Reflection;
private void changeBackground()
{
string imageName = "";
if(_player.CurrentLocation.ID == 1)
{
imageName = "cave.png";
}
else if (_player.CurrentLocation.ID == 2)
{
imageName = "city.png";
}
else if (_player.CurrentLocation.ID == 3)
{
imageName = "death Gate.png";
}
else if (_player.CurrentLocation.ID == 4)
{
imageName = "Fog.png";
}
else if (_player.CurrentLocation.ID == 5)
{
imageName = "castle.png";
}
else if (_player.CurrentLocation.ID == 6)
{
imageName = "library.png";
}
else if (_player.CurrentLocation.ID == 7)
{
imageName = "ruins.png";
}
else if (_player.CurrentLocation.ID == 8)
{
imageName = "swamp.png";
}
else if (_player.CurrentLocation.ID == 9)
{
imageName = "finile gate.png";
}
if (imageName != "")
{
if(pbMain.Image != null)
{
pbMain.Image.Dispose();
}
using (Stream resourceStream =
Assembly.GetExecutingAssembly().GetManifestResourceStream(Assembly.GetExecutingAssembly().GetName().Name + ".Resources." + imageName))
{
if (resourceStream != null)
{
pbMain.Image = new Bitmap(resourceStream);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment