Taking a victory lap on today's hobby hacking game dev progress. Camera control! The camera now follows the player, but not beyond the extent of the tilemap.
Taking a victory lap on today's hobby hacking game dev progress. Camera control! The camera now follows the player, but not beyond the extent of the tilemap.
@onelson VERY cool!
Since, I will need to implement something similar in an upcoming project: Do you know whether bevy automatically only renders the visible part of the tile map or does it always render the entire map, then just crops the image appropriately?
@BafDyce I'm delegating the tile rendering to https://github.com/Trouv/bevy_ecs_ldtk and I haven't checked the details.
My guess is it's less sophisticated, rendering all the tiles out as a texture on a quad in one shot. I've got data in the LDtK scene to tell me which tiles are which type of terrain, and in that situation I have more control -- I could look the data up from the scene ad hoc. I'm not though, I'm building a map of tile offsets and their types up front.
@onelson I see, thanks! Last time I checked (2ish years ago?) this crate didnt exist yet (or I was unable to find it?)
Definitely makes me wanting to start the project *now* 😂
@BafDyce I only recently found out about LDtK. I had always tried working with Tiled in the past, but LDtK seems much more user-friendly.
The crate I linked is built on top of a separate one which mostly covers the types used to parse the JSON scene files.
FYI, I struggled to reconcile the differing coordinate systems. LDtK is Y-down, vs Bevy's Y-up. Figuring out which parts of the API use which system was a bother, but I think I'm past that now 😅
@BafDyce I just wanted to be sure to disclose 😅
There's a bunch of coordinate conversion helper functions in the crate but I should have looked at their bodies long before I actually did. None of them did the math I needed to pull the data I wanted out of the scene. Had to write my own.