Changing Actor's Layer position
sparkania
Member, PRO Posts: 300
ok.. another quick question.
I know that Spawing allows the new actor to be placed in front or back of a layer. Is there a behavior which can change an active actor's position in it's layer?
I know that Spawing allows the new actor to be placed in front or back of a layer. Is there a behavior which can change an active actor's position in it's layer?
Comments
Hi @sparkania no, changing layer order with behaviours/during runtime is not possible at the moment, unfortunately.... possibly on the cards for a future GSC release though.... just have to go with the workarounds for the while...
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
'Tis a nuisance, sometimes... but depending on your situation, the workarounds can help... for instance, if the object is to be totally out of site (outa sight, man! ;-) ) and hasn't got Rules for touch in it, just make its Alpha zero; or even move it outside of the visible screen temporarily, if that'd work in your situation....
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
OK, so by the sound of it the only other workaround is to destroy it and spawn it in the back of the layer, as you know...
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
plus I just looked at the XML for the scene, the Layer position is not a value but rather the order in which the actor is written in the scene. so there's no real 'switch' to mess with.
True, although there's a bit of leeway because of the fact you can make levels into separate groups; this helps out in a few situations.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
There'd be no need to swap the layers groups if you made sure that, at least, the actor that appears in front, then at another time at the back of a second actor, that these two actors are in the same layer group... then destroying and spawning in the back of the layer will make the actor just in the back of the particular layer group its in.
Just thought I'd clarify that for other members who might find it useful information...
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
2. Constrain the x-y coordinates of the bottom to table x/y attributes.
3. Add a spawn actor behavior to the bottom half, to spawn the top half.
4. In the top half, constrain the x/y constraints of the top half to the the table attributes + how many y pixels high that the top half sits on the bottom half.
This will create a layering effect.
- make sure that the top half is equal to the bottom or else the effect won't work when overlapping with other actors.
- I was able to get away with about 10 actors at once without trouble, but after that it starts to hit the processor. The problem is that it processes to the thousandth decimal point. If the smooth temporal mapping was in tenths, it would probably allow many more actors at once.
- there are ways to have actors automatically add themselves to table rows so you can have npc's automatically map themselves when having multiple npc's of the same type. Not explaining it here.
In theory you COULD program that by causing a respawn of actors in order dictated by their distance from the player or camera every time there is movement, but that would get very very processor heavy and essentially be worthless for game creation.
Grim