Movement issue

I have an issue in the movement on the classy clash part, hte instructor use this code to stop the camera at the (0.0, 0.0) position of the map

if (Vector2Length(direction) != 0.0)
        {
            // set mapPos = mapPos - direction
            mapPos = Vector2Subtract(mapPos, Vector2Normalize(direction));
        }

but when I try this code in my project the camera stills move in that direction
image
How could I fix this?

1 Like

Hi Arturo,

I checked the lecture (4 - Movement) and nowhere does Stephen mention that code would stop the camera at position (0.0, 0.0).

The code you’re showing also just moves the map without any limitations other than moving the map only when we want it to move. We do eventually do what you’re describing by stopping the player from moving into the water at a later lecture, though.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms