public void initLevel(ContentManager content, int sWidth, int sHeight) { //ContentManager.RootDirectory = "Content"; LevelReader.setPlayer(levelFile, content, player, sWidth, sHeight); ground = LevelReader.readGround(levelFile, content, sWidth, sHeight); enemies = LevelReader.readEnemies(levelFile, content, sWidth, sHeight); background = LevelReader.readBackground(levelFile, content); loadscreen = LevelReader.readLevelLoadScrn(levelFile, content); levelname = LevelReader.readLevelName(levelFile); levelbgm = LevelReader.readLevelBGM(levelFile, content); levelintrobgm = LevelReader.readLevelIntroBGM(levelFile, content); //init explosion sprite to be used by dead enemies Explosion aexplosion = new Explosion(); Texture2D[] exparray = { content.Load <Texture2D>("explode1"), content.Load <Texture2D>("explode2"), content.Load <Texture2D>("explode3"), content.Load <Texture2D>("explode4") }; aexplosion.setTextures(exparray); }
//CONSTRUCTOR public Pgame() { //Initialize graphics object and content directory graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; //Set initial screen paramaters Vector2 res = LevelReader.readResolution("settings.txt"); startingwidth = (int)res.X; startingheight = (int)res.Y; //Console.Out.WriteLine(startingwidth + " " + startingheight); startfullscreen = LevelReader.readFullScreen("settings.txt"); volume = LevelReader.readVolume("settings.txt"); bgmvolume = LevelReader.readBGMVolume("settings.txt"); gamepadConnected = LevelReader.readGamepadSetting("settings.txt"); graphics.PreferredBackBufferHeight = startingheight; graphics.PreferredBackBufferWidth = startingwidth; //this.lastscale = 1; //this.currentscale = 1; graphics.IsFullScreen = startfullscreen; screenRect = new Rectangle(); screenRect.X = 0; screenRect.Y = 0; screenRect.Width = startingwidth; screenRect.Height = startingheight; //Init attacks; pAttacks = new ArrayList(); gamestate = PGameState.Title; //Set initial player, level position //levelloc = Vector2.Zero; }
//Graphical content is loaded here protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); //Set level, init currentLevel = new Plevel(levelFileList[currentLevelIndex]); currentLevel.initLevel(this.Content, startingwidth, startingheight); //Load content from level player = currentLevel.getPlayer(); groundlist = currentLevel.getGround(); enemylist = currentLevel.getEnemies(); background = currentLevel.getBackground(); levelname = currentLevel.getName(); loadscreen = currentLevel.getLoadScrn(); //Load TitleScreen if (gamestate == PGameState.Title) { titlescrn = LevelReader.readTitleScrn("title", Content); } //FONT LOAD Font1 = Content.Load <SpriteFont>("SpriteFont1"); FontPos = Vector2.Zero; FontPos.Y += 20; //Set master volume SoundEffect.MasterVolume = (float)volume; MediaPlayer.Volume = (float)bgmvolume; levelTimeElapsed = 0; }
public EnemySprite getDelayedLevelGoal(ContentManager content, Vector2 position) { return(LevelReader.readDelayedLevelGoal(levelFile, content, position)); }