HaxeFlixel, HUD and z-order

675 views
Skip to first unread message

Egor Vasilyev

unread,
Jun 5, 2015, 9:42:23 PM6/5/15
to haxef...@googlegroups.com
Hi! I create some of game objects (background, enemies, bullets) after adding a HUD on scene. So all of them drawing over my HUD. 

How i can draw my HUD over all other objects?

Junjo

unread,
Jun 6, 2015, 4:58:47 AM6/6/15
to haxef...@googlegroups.com
Hi Egor,

You can make use of FlxGroup objects to control the drawing order.

For example, create and add a flxgroup to the state and after that add the hud (to the state too).
Then, instead of adding your game objects directly to the state, add them to the flxgroup, that way they will be drawn before the hud.

Egor Vasilyev

unread,
Jun 6, 2015, 6:25:58 AM6/6/15
to haxef...@googlegroups.com
I know about this solution, but it seems too excess, cause i need to draw just one element - HUD - over other objects. Also "y" coord of HUD less, than "y" coord of background, so that not solve my problem.

Is there are any others solution of depth sorting?

суббота, 6 июня 2015 г., 11:58:47 UTC+3 пользователь Junjo написал:

Gama11

unread,
Jun 6, 2015, 7:20:49 AM6/6/15
to haxef...@googlegroups.com, e.va...@nexters.com
The members array determines draw order. Just make sure you HUD has the highest index (add it last, or if you need to add any objects after that manually adjust the index) and it will be drawn on top of everything else.

I don't see what the problem with using a FlxGroup is though, that way you don't have to do any manual index-management.

JuanJosé Martínez

unread,
Jun 6, 2015, 8:41:14 AM6/6/15
to haxef...@googlegroups.com
I'm not suggesting any y-sorting of the flxgroup object, just to use it as a "layer" that is drawn (with all its contents) before the hud object.


--
HaxeFlixel Development Community
See our github https://github.com/haxeflixel/ and our documentation http://haxeflixel.com/documentation/
---
You received this message because you are subscribed to a topic in the Google Groups "HaxeFlixel" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/haxeflixel/DrDXEani_oY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to haxeflixel+...@googlegroups.com.
Visit this group at http://groups.google.com/group/haxeflixel.
To view this discussion on the web visit https://groups.google.com/d/msgid/haxeflixel/551e26c1-dd5a-4e2e-9cd2-b0d3dbf64e44%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages