// world height and width must be a multiple of 15 in order to work public World(Game game, int wHeight, int wWidth, SpriteBatch batch, Player pl) : base(game) { name = "World 1"; height = wHeight; width = wWidth; spriteBatch = batch; biomes = new List<Biome>(); playerSpawns = new List<Spawn>(); player = pl; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); noDraw = false; player = new Player(this, 100, 0, new Inventory(this), new Spawn(this)); homeWorld = new World(this, 0, 0, spriteBatch, player); homeWorld.DrawOrder = 0; mainMenu = new Menu(this); mainMenu.DrawOrder = 1; // add the various component classes to components Components.Add(homeWorld); Components.Add(mainMenu); // add the mouse cursor cursor = Content.Load<Texture2D>("UI tex/cursor"); mouse = Mouse.GetState(); base.Initialize(); }
public void worldFileWriter() { StreamWriter sw = new StreamWriter("../../../../Evolution GameContent/world data/" + name + ".wld"); sw.WriteLine(width + "," + height); sw.WriteLine(biomes.Count); sw.WriteLine(segTotalX + "," + segTotalY); foreach (Biome b in biomes) { sw.WriteLine(b.getName() + "," + b.getType() + "," + b.getSegment().X + "," + b.getSegment().Y + "," + b.getWidth() + "," + b.getHeight() + "," + b.getPosition().X + "," + b.getPosition().Y + "," + b.spawnHere()); if (b.spawnHere()) { player = new Player(Game, 100, 0, new Inventory(Game), new Spawn(Game, b, b.getPosition(), true)); } } sw.Close(); Console.WriteLine("World file " + name + ".wld written successfully"); player.writePlayerFile(); }
public World(Game game) : base(game) { // TODO: Construct any child components here player = new Player(Game); }