public static void init() { foreground = null; //foreground = new ParallaxForeground(); //foreground.layers.Add(new ParallaxLayer((Texture2D)Loader.load<Texture2D>("Parallax/realtest_trees_back", "Content/Parallax/realtest_trees_back.png"), 1.5f, false, 0)); //foreground.layers.Add(new ParallaxLayer((Texture2D)Loader.load<Texture2D>("Parallax/realtest_trees_front", "Content/Parallax/realtest_trees_front.png"), 2f, false, 0)); }
public static void updateForeground() { GameLocation location = Game1.currentLocation; if (location != null && location.map != null && location.map.Properties.ContainsKey("Foreground")) { Logger.log("Found Foreground property, " + location.map.Properties["Foreground"].ToString()); bool useHorizon = false; int horizon = 0; Dictionary <string, object> foregroundSource = (Dictionary <string, object>)Loader.load <Dictionary <string, object> >("Content/Parallax/" + location.map.Properties["Foreground"].ToString() + ".json"); List <ParallaxLayer> layers = buildForeground(foregroundSource, location.map.Properties["Foreground"].ToString()); foreground = new ParallaxForeground(layers); } else { //Logger.log("Location did not have a Foreground property"); //Game1.background = null; } }