Hey,
I found libGdx a few weeks a ago and I like it so far.
But now I want to load a tiled map und render it.
My Problem now is I don´t knew how camera, Renderer, Map and the Frame are playing together.
I already read nearly all Tutorials and YT Tutorials, but these are most Sidescrollers.
I just want that my left bottom of the map is also there in the Frame, but the beginning of the map is approx. at 70% on x and 30% on y in the frame, the rest is blank. And my player which, startpoint is at x=0 and y=100 is spawning at this location, but on the blank part. (Hope somebody understands what I mean)
So, how is it possible to tell the camera really to watch the map and not the frame?
I guess when i call "batch.draw(player,…) it is drawing everything on the screen, so its normal that my player is on this position.
When I do it like that: camera.setToOrtho(false, map.tileWidth * 20, map.tileHeight * 20);
and in the render: renderer.render(camera,…)
The map is correctly beginning on (0,0) but when I add
camera.position.x=player.position.x-player.getImage().getWidth()/2;
camera.position.y=player.position.y-player.getImage().getHeight()/2;
in render, the above thing is happening. So, how do I do it correctly?
What is project/unproject and combined doing?
Is this something like, I have a map with 4000x3000px and a Frame with 720p and I click now in the frame on 500,600 but I am in the map on 3000x1200 unproject is now translating to the map and project is then doing the counterpart?
Does that mean that i have to call everytime when I click on a object unproject() and when I done with the logic project()?
I am normally using Tiled, is there an other better Editor?
Like for collision detection? I am currently making an own layer and then draw a special tile on the blocked Tiles.
But what should I do when the Tile is a side tile? So, a 32x32 but only has 7px which should be blocked, is there a way to do it? It´s a little bit annoying to block an whole Tile for that. Or half water and half grass on a Tile, how to do?