Exemple #1
0
        public override async Task Enter(Dictionary <string, object> parameters)
        {
            var levelMaker = new LevelMaker();

            CamX        = 0;
            CamY        = 0;
            Level       = levelMaker.Generate(100, 10);
            TileMap     = Level.TileMap;
            Background  = Super50Bros.Instance.Random.Next(3);
            BackgroundX = 0;

            GravityOn     = true;
            GravityAmount = 6 * 60; // ~60 FPS

            Player = new Player(
                0, 0,
                16, 20,
                "green-alien",
                null,
                TileMap,
                Level
                );

            Player.StateMachine = new StateMachine(new Dictionary <string, State>
            {
                ["idle"]    = new PlayerIdleState(Player),
                ["walking"] = new PlayerWalkingState(Player),
                ["jump"]    = new PlayerJumpState(Player, GravityAmount),
                ["falling"] = new PlayerFallingState(Player, GravityAmount)
            });

            await SpawnEnemies();

            await Player.ChangeState("falling");
        }
Exemple #2
0
        public override Task Enter(Dictionary <string, object> parameters)
        {
            var levelMaker = new LevelMaker();

            Map        = levelMaker.Generate(100, 10);
            Background = Super50Bros.Instance.Random.Next(3);

            var height = Super50Bros.Instance.Textures["backgrounds"].Height;

            return(Task.CompletedTask);
        }