Exemplo n.º 1
0
        public void Update() {
            
            nextChunk.Update();

            if (player.Position.X < chunkEndPos) return;

            previousChunk.UnloadChunk();
            previousChunk = currentChunk;
            currentChunk = nextChunk;
            InstantiateNextChunk();

            chunkEndPos = currentChunk.Start.X + Utility.ChunkLength * Utility.BLOCK_POSITION_SCALE;
        }
Exemplo n.º 2
0
        public InfiniteLevel() {
            Seed = System.DateTime.Now.Millisecond;
            rand = new Random(Seed);

            previousChunk = new Chunk(Vector2.Zero, Utility.STARTING_HEIGHT, rand);
            currentChunk = new Chunk(Vector2.Zero, Utility.STARTING_HEIGHT, rand);

            currentChunk.ForceEnemiesOff(); //Having enemies spawn in the first chunk is really annoying
            while (currentChunk.ChunkXValue < Utility.ChunkLength)
                currentChunk.Update();

            InstantiateNextChunk();

            player = SprintFourGame.GetInstance().Mario;
            player.Position = Utility.MarioStartPos;

            Level.LevelHeight = Utility.WorldHeight;
            Level.LevelWidth = int.MaxValue;

            chunkEndPos = Utility.ChunkLength * Utility.BLOCK_POSITION_SCALE;
        }
Exemplo n.º 3
0
 void InstantiateNextChunk() {
     nextChunk = new Chunk(new Vector2(currentChunk.Start.X + Utility.ChunkLength * Utility.BLOCK_POSITION_SCALE, Utility.ZERO), currentChunk.ChunkYValue, rand);
 }