Problems with the camera
Closed this issue · 9 comments
I've posted this in your blog but I think this is a better place to my issue:
I am using MarteEngine 0.3 and I have a problem with the Camera for my game, my problem is that I add three layers of depth to the game and I can't move them together.
addAll(nivel.getEntities(1), World.BELOW); //Thing below the player, the actual map.
addAll(nivel.getEntities(0), World.GAME); // collision blocks
add(player, World.GAME); //player
add(npc1, World.GAME); // npcs
addAll(nivel.getEntities(2), World.ABOVE); //things above the player
This way, I can render things above the player, like a roof or an umbrella, but the camera only moves the GAME layer.
If I change everything to World.GAME everything works perfectly, but the character gains the ability to fly over everything.
What can I do? :(
hi and yes this is a better place :D
what version of ME are you using? from dev branch ?
Yes, the dev branch. I don't remember where I downloaded the jar file, though... But it's compatible with your Rogue Like tutorial.
Where are the latest jar version of MarteEngine? I've never been able to find them. :(
there is no jar, you need to clone dev branch to get lastest version. I hope get ready for version 0.3 soon with a new jar
Oh, I see.
Well, and about my problem, is there anything I can do? My game is a school project and I have to hand it the 23th of May. :(
sure, download version 0.3 in development from here: https://github.com/Gornova/MarteEngine/zipball/dev
import into eclipse this project and reference it into your build path instead of version 0.2
Deses,
The World.add flags (BELOW, GAME, ABOVE) Allow an entity to ignore the camera position by using ABOVE or BELOW.
Like a GUI that always remains at the same location.
Everything in your map(units, buildings) that should scroll should be in the GAME layer.
The Entity.depth variable allows to render entities on top of each other.
So I would store the depths you need like:
GAME = 0 ABOVE = 1
Then when creating your roof you set the depth:
roof.depth = ABOVE
and it will overlap your player.
I haven't tested this.
Ooooooh!! Everything is working now! Weeeeeeee.
Thank you a LOT!
Anyway, you should be doing some documentation soon. xD
I have an other issue related with the camera... >.<
When I'm on the state 1, the main menu, where there are no camera, and enter to the state 2, the main world, and I initialize my player far away from the coordinates 0,0, the camera instead of starting above the player, takes some time travelling from 0,0 to the point where the player is, then it works fine...
Is there a way to tell the camera where to begin?
God, I should look for myself a little bit more before asking for help... I just fixed it:
this.camera.cameraX = 2880;
this.camera.cameraY = 2200;