Java LibGDX: How to get a map based coordinate system?

I'm making a 2D isometric tiled game using LibGDX. In my Player class, I created a vector2 that I named 'pos' to manage the player position, then I draw my Player with:

batch.begin();
batch.draw(localPlayer.texture,LocalPlayer.pos.x,LocalPlayer.pos.y);
batch.end();

Let's say pos = (0,0), then the Player will be rendered at the bottom left corner of my screen.

When I translate the camera, the (0,0) still correspond with the bottom left of my screen, so the pos Vector2 is about my screen, not my map...

What should I do to get a Coordinate System based on the map and not on my screen? I would not prefer using the Sprite Class...

Thank you :)


Basim Khajwal was right,

calling batch.setProjectionMatrix(camera.combined) works perfectly :)

However if you are looking for a deeper comprehension you can also read this article here:

http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/

Where "view position" is your screen position and "model position" is your map position.

链接地址: http://www.djcxy.com/p/71214.html

上一篇: CSS3 rotateY没有应用转换

下一篇: Java LibGDX:如何获取基于地图的坐标系?