(Solved) How to inherit zorder attribute for Custom Sprite

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
SypherZent
Veteran
Posts: 362
Joined: Fri Sep 02, 2016 3:14 am
Completed: Multiverse Heroes, Space Hamster in Turmoil
Location: Puerto Rico
Contact:

(Solved) How to inherit zorder attribute for Custom Sprite

#1 Post by SypherZent »

Edit: Eh, figured it out myself after a while.

Code: Select all

            self.show = manager.create(sprite)
            self.show.x = xpos
            self.show.y = ypos
            # ZOrder: MaxTileHeight - Elev = Higher ZOrder for Taller Tiles
            # ZOrder: + (setup_map_rows - x_coord) = Higher ZOrder for Closer Tiles
            # (5 - 0) + ((5 - 0)*2) = 15
            self.show.zorder = zorder
It's already there in the manager, just had to call it.
Hope it helps the next guy. ^^

----------

Hello,

I feel like this should be simple, but I find myself at a loss.
I've created a custom Sprite and I am showing it with sprite manager.

After I have loaded my sprites, I notice some are on top of others.
Rather than script mathematical logic to place them properly, I think zorder would be simplest solution.

How can I have my custom Sprite objects, created with SpriteManager, inherit a zorder attribute so the sprite manager can place each individual sprite according to the zorder?

Thanks.
Creator of Multiverse Heroes & Space Hamster in Turmoil

Want me to code your game?
Check my services thread!

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot]