Forum begins after the advertisement:


[Part 11] Map generation improvement bug

Home Forums Video Game Tutorial Series Creating a Rogue-like Shoot-em Up in Unity [Part 11] Map generation improvement bug

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #15866
    NightShadowBlade
    Participant
    Helpful?
    Up
    0
    ::

    View post on imgur.com


    I was working on the map generation improvement part and my player can go to the right side of the map and then spawn terrain chunks but not on the left side on the map, it would but only when the player goes up or down at the empty space. How do i fix this issue?

    #15871
    Terence
    Keymaster
    Helpful?
    Up
    0
    ::

    Can you check if the Left markers in your chunks are spelled with the correct capitalisation? And whether your MapController script spells “Left” in the same way as well:

        void ChunkChecker()
        {
            if (!currentChunk)
            {
                return;
            }
    
            Vector3 moveDir = player.transform.position - playerLastPosition;
            playerLastPosition = player.transform.position;
    
            string directionName = GetDirectionName(moveDir);
    
            CheckAndSpawnChunk(directionName);
    
            // Check additional adjacent directions for diagonal chunks
            if (directionName.Contains("Up"))
            {
                CheckAndSpawnChunk("Up");
            }
            if (directionName.Contains("Down"))
            {
                CheckAndSpawnChunk("Down");
            }
            if (directionName.Contains("Right"))
            {
                CheckAndSpawnChunk("Right");
            }
            if (directionName.Contains("Left"))
            {
                CheckAndSpawnChunk("Left");
            }
        }
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Go to Login Page →


Advertisement below: