Skip to content
Discussion options

You must be logged in to vote
  • You need to modulo the x with the width for it to wrap. I like rem_euclid for this purpose. Modulo is quite expensive on thumb even if the value is known at compile time, that is unless the value is a power of 2.
    basic_tiles::basic.tile_settings[
        *level::ARRAY.get(
            (pos.x.rem_euclid(level::WIDTH)+ level::WIDTH * pos.y) as usize
        ).unwrap_or(&0)
    ],
  • If you're not expecting the pink between the maps, that's because you are referring to tile 0 in the level array.

Hope that helps!

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Kiel97
Comment options

Answer selected by Kiel97
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants