Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tile Map Tutorial places map (tile at (0,0) in the center of the screen #928

Open
dblhack opened this issue Aug 5, 2024 · 1 comment
Open

Comments

@dblhack
Copy link

dblhack commented Aug 5, 2024

The sample tutorial for version 4.0 loads tile map so that the map is offset from position (0,0) of the screen. Using the same code base as the sample, I load my tile map and the upper left of my map is in the center of the screen. See attached screen shot.
Tile Map not positioned at (0,0) of screen

I also uploaded a screen shot from the actual tutorial. I fully expect the map start at position (0,0).Tile Sample Output

It could be I totally don't understand the code, but since my map has objects embedded in it and I need to create those objects at the location they were placed in the map, I don't see how to create them with the offset.

@dblhack
Copy link
Author

dblhack commented Aug 6, 2024

I believe the issue is cause from using the Camera.LookAt() method.

protected override void Update(GameTime gameTime)
{
_tiledMapRenderer.Update(gameTime);

MoveCamera(gameTime);
_camera.LookAt(_cameraPosition); // <<<----------This is the issue, always puts origin in center

base.Update(gameTime);

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants