|
Post by tipsygipsy on Dec 15, 2014 12:59:36 GMT
hi all,
how do I make z-index work with shadows and put them in a z-node? I tried adding the shadow_node to the z-node but the results was weird.
thank you!
|
|
|
Post by Admin on Dec 15, 2014 20:18:55 GMT
hello tipsygipsy, because of the way shadow nodes work (a canvas that is rendered over the entire screen) it is only usable for purely 2d rendering (top-down or side view games, where z-order have no effect). if you want to do shadow with z-order you can always render the sprite itself but with blending and black color with half opacity. maybe squeeze it in height and rotate to create more realistic shadow. for example, here's an example snippet from a test project I've made: Ness::SpritePtr shadow = obj_node->create_sprite("tree.png"); shadow->set_anchor(Ness::Point(0.5f, 1.0f)); shadow->set_blend_mode(Ness::BLEND_MODE_BLEND); shadow->set_color(Ness::Color::BLACK * Ness::Color(0.0f, 0.0f, 0.0f, 0.35f)); shadow->set_rotation(35); shadow->set_scale(Ness::Point(1.0f, 0.75f)); the reason you don't see me set z-index or position here its because the shadow is in the same node as the sprite itself, and the node have position and z-index already configured. hope this helps
|
|