Author Topic: Change sprite draw order  (Read 5124 times)

eric22222

  • Fanatic
  • ***
  • Posts: 177
    • View Profile
    • Eric Online
    • Email
Change sprite draw order
« on: 2014-04-09, 09:22:06 PM »
Hey guys, anyone know of a good way to change the order spirtes within a layer are drawn? I'd like to keep my player on top, but it seems to draw from oldest to newest. Didn't find anything in the layer base file, but I may not be looking hard enough. Thanks!

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Change sprite draw order
« Reply #1 on: 2014-04-10, 04:58:18 AM »
Select a sprite in the map editor and you should see a "Priority" property. For sprites added at design time, that should control the order in which they are drawn. I believe the priority number is not available at runtime, only at design time. The effect it has it to determine the sort order in which the sprites design objects are generated into the code that adds sprites to the collections, and consequently, the order that they are drawn at run-time.

eric22222

  • Fanatic
  • ***
  • Posts: 177
    • View Profile
    • Eric Online
    • Email
Re: Change sprite draw order
« Reply #2 on: 2014-04-10, 07:22:10 PM »
Ah, that may be my problem. I'm trying to keep my player on top of some sprites I generate on the fly. I can probably work around it with some layer shenanigans, though. Thanks for the help!