Skip to content

Instantly share code, notes, and snippets.

@ScottLilly ScottLilly/ForgottenLand.cs Secret
Created Feb 23, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.