public GameState(IStateChanger stateChanger, GraphicsDevice graphicsDevice, ContentManager content)
            : base(stateChanger, graphicsDevice, content)
        {
            scale       = 1.6f;
            movement    = new Movement(6, 12, 24);
            aniCreator  = new AnimationCreator();
            levelBinder = new LevelBinder();
            collidy     = new CollisionManager();
            spriteBatch = new SpriteBatch(graphicsDevice);

            Texture2D texture        = content.Load <Texture2D>("LightBandit_Spritesheet");
            Texture2D tileset        = content.Load <Texture2D>("tileset");
            Texture2D LavaTexture    = content.Load <Texture2D>("pngkey.com-lava-png-2333904");
            Texture2D portalTexture  = content.Load <Texture2D>("Green Portal Sprite Sheet");
            Texture2D HeartTexture   = content.Load <Texture2D>("heart-sprite-png-2");
            Texture2D NumbersTexture = content.Load <Texture2D>("aGOgp");

            remote = new KeyBoard();
            ((KeyBoard)remote).downk   = Keys.Down;
            ((KeyBoard)remote).upk     = Keys.Space;
            ((KeyBoard)remote).leftk   = Keys.A;
            ((KeyBoard)remote).rightk  = Keys.D;
            ((KeyBoard)remote).sprintk = Keys.LeftShift;

            gravity      = new Gravity(4, 0.3f, 0.7f);
            player       = new Player(new Vector2(100, 800), 60, 52, scale, texture, remote, movement, aniCreator, gravity);
            lava         = new LavaSheet(LavaTexture, new Vector2(-10, 1100), scale);
            currentLevel = new Level(player, tileset, portalTexture, new Vector2(-10, -40), levelBinder, lava, scale);
            levelcollidy = new LevelCollision(player, currentLevel, collidy);
            gameOver     = new GameOver(player, lava, collidy, currentLevel);
            nextLevel    = new NextLevel(player, currentLevel, collidy, stateChanger, graphicsDevice, content, lava);
            hud          = new HUD(HeartTexture, NumbersTexture, aniCreator, player);

            batchUpdater = new BatchUpdater(gravity, player, levelcollidy, currentLevel, gameOver, nextLevel, hud);
        }
 public Level(Player player, Texture2D texture, Texture2D portalTexture, Vector2 position, LevelBinder levelbinder, LavaSheet lava, float scale)
 {
     this.texture         = texture;
     this.InitialPosition = position;
     this.scale           = scale;
     this.levelbinder     = levelbinder;
     this.levelToDraw     = levelbinder.currentLevel;
     this.lava            = lava;
     this.portalTexture   = portalTexture;
     this.player          = player;
     CreateWorld();
 }
Beispiel #3
0
        public void CreatLevel()
        {
            string[] data  = LevelReader.GetInputData();
            Level    level = LevelBinder.CreateLevel(data);

            if (LevelValidator.IsValid(level))
            {
                LevelsInfo.Add(level);
                LevelSaver.Save(level, pathToFile);

                Console.WriteLine("Level created and saved.."); // remove CW from BL
                Thread.Sleep(3000);
            }
            else
            {
                Console.WriteLine("level info is wrong");// remove CW from BL
            }
        }
Beispiel #4
0
 public ILevelConfigurator UseMapBinder(LevelBinder binder)
 {
     _parameters.Binder = binder;
     return(this);
 }