-
Notifications
You must be signed in to change notification settings - Fork 65
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
Replacing a single tile during run #38
Comments
Sorry this isn't easily done without a bit of work. You'd probably need to keep your array of tile IDs around during run time, modify those, then resubmit them to build a new vertex array (if this happens infrequently then there should be very little impact on performance). If you have only a few tiles which change it might be OK to just draw a new sprite over the top of the tile layer. If you do decide to make your own renderer, I'd suggest starting at the basics. There's a tile map example on the sfml site here which you can use to get started. The main difference is that instead of a fixed array of tile IDs you use the tile IDs loaded from the tmx file. Once you get that working with a single tile set you can start to build on it, adding support for more textures, while including the option to update tiles. No smart pointers needed! :) Don't forget you can always hop on the sfml irc or discord server if you want some advice, there's usually someone helpful around to give you a hand |
It really depends on the playstyle of the player lol. If he decides to burn down the whole forest it would be like 500 tiles of 40.000. Edit: |
The problem with sprites is that you have a Viewport culling (ie only drawing what's in view) is also a good idea. It gets a bit trickier when using vertex arrays, but they can be broken into smaller parts - which is the idea behind the |
tmxlite/SFMLExample/src/SFMLOrthogonalLayer.hpp
Line 124 in 1e756d9
I am trying to modify the SFMLOrthogonalLayer.hpp so that I can update a single tile when the player destroys it (replace it with another tileID), but I'm having problems accessing the ChunkArray inside the Chunk which Vertices I would have to modify in order to replace a tile.
Any tips on how to do it? If not I might have to replace the whole renderer, that would be alot of work... I'm new to C++ and struggling to understand the unique pointers and all that stuff
The text was updated successfully, but these errors were encountered: