-
Notifications
You must be signed in to change notification settings - Fork 28
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
Sorting with sprites on same y coord is incorrect #47
Comments
Is it possible to make this intended behavior? I am trying to render the tile that the character is on, after the character so that they look like they are inside the tile. ( Like for grass). I am unsure if that's the way games do it or they have some other method. What i am thinking is that, the pyscroll group can take layer names to render the characters after them only if they are on them. I saw that you have sprite damage in the files, not sure if my request is going to be done that way. |
You can already do this by the way pyscroll layers tile layers. You just
need to make sure the tiles you want above the character are in a layer
number that is higher than the character layer.
That's how I have the player walk under trees.
…On Mon, Nov 29, 2021, 12:08 PM javier5109 ***@***.***> wrote:
Is it possible to make this intended behavior? I am trying to render the
tile that the character is on, after the character so that they look like
they are inside the tile. ( Like for grass). I am unsure if that's the way
games do it or they have some other method.
What i am thinking is that, the pyscroll group can take layer names to
render the characters after them only if they are on them.
I saw that you have sprite damage in the files, not sure if my request is
going to be done that way.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#47 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALVS7DNVR22NT5YXMNFIQDTUOPFUBANCNFSM5DIB25SA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Sorry, i wasn't clear enough. I was thinking conditional rendering for tiles on the same level as the player. If they collide then it is rendered after, else it is rendered before. I am working on the assumption that this is how u do the rendering for grass and stuff. I attempted to do the conditional rendering myself with other sprites but I don't know how to get the world offset and screen transformation data from buffered renderer |
I see what you mean: You need to render the lower part of the sprites below
the grass tiles and the upper half above. So, that the grass wouldn't cover
your head as well. So, basically just paint the grass tile your feet are on
above the sprite, but the others below.
I have no idea how you'd do this in pyscroll, other than capturing the tile
image using pytmx get_tile_image and redrawing it over the sprite using
blit after the other layers are drawn. I mean, it doesn't matter if it
draws it twice right? That should be pretty easy to do actually.
I do use tile based collision detection with pyscroll in my game (Sky
Realm) and I just have it draw a variation of the sprite without feet when
they are in the grass, but this wouldn't work with tiles with transparent
pixels like in stardew valley (my grass is solid).
To do the tile based collision detection. You just assign the tiles you
want drawn over the player some property (in tiled). Then have it check the
properties of the tile you are on using get_tile_properties.
Perhaps bitcraft knows a better way to do this under the current system,
but if not this would be a pretty cool integrated feature. Then again
though, I don't think Tiled maps would store the information in any direct
way. My guess is you'd be best off using tile properties like I do in my
game. So, it seems a bit beyond the direct scope of pyscroll and pytmx.
…On Mon, Nov 29, 2021, 4:30 PM javier5109 ***@***.***> wrote:
Sorry, i wasn't clear enough. I was thinking conditional rendering for
tiles on the same level as the player. If they collide then it is rendered
after, else it is rendered before.
Example down below. Where the player rendered based on the tile it is on.
I assumed that that this bug could be used to figure out where the player
is and render conditionally.
I am working on the assumption that this is how u do the rendering for
grass and stuff. I attempted to do the conditional rendering myself with
other sprites but I don't know how to get the world offset and screen
transformation data from buffered renderer
[image: Screenshot_20211129-142445]
<https://user-images.githubusercontent.com/80359125/143958528-d5a47b45-9672-4b57-990d-75946ed35908.jpg>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#47 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALVS7DIHLKKLZKQDZYOH5U3UOQEH3ANCNFSM5DIB25SA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
i've wrestled with how to do this a bit and currently, the sprite will always be over all the tiles of the layer that it shares tiles with. there is a "tall_sprites" feature, which needs more work, but the idea is that:
it can be slightly configured using the "tall_sprites" value, but its not really designed for general use -- the only game that uses it is Tuxemon, and that game has a pretty specific way of rendering tiles. for rendering the player in the grass, there is a layer of half-grass tiles, and the tall_sprites value determines when to draw the player sprite over the grass. thinking about stardew valley, i don't think that this is something for pyscroll to deal with (though i might change my mind about it). pyscroll is really meant to draw the background and forground layers of a game, but not the objects. the tall grass and crops in SDV would be sprites in a game. for pyscroll, they would be passed into the renderer with layers, and pyscroll could render them as you see it, being in the crops/grass, etc. it gets a bit more complicated if you were to put the grass tiles in Tiled, but if you were to treat them as game sprites, then i don't think there would be a problem with rendering. feel free to try it out or ask questions..... putting more features into this kind of render puts pyscroll more into "rendering system" rather than being a "tilemap renderer", but i think that eventually i would like to support it, |
btw, layers for sprites are supported using the method with pygame groups. you can set |
probably not a common situation, but the stump tiles are aligned with the sprite on the bottom edge. when sorted, their b (bottom) values are the same, so then they are sorted by the x value, so the stump on the right is drawn after the sprite.
The text was updated successfully, but these errors were encountered: