Possible to make actor to have certain behavior on different layer?

Hi, there is this certain behavior I would like to achieve, which is crucial, is that possible to make actor to have higher z-index if they are closer to the bottom of the screen? I'm trying to make this overlapping actor, but when they are stacking up, it started to looks weird. Please advise. Thanks.

image

As for the overlapping, can gamesalad create something like image below?
image

Thanks in advance!

Best Answers

  • SocksSocks London, UK.Posts: 12,822
    edited October 2013 Accepted Answer
    GameSalad users have no direct control over layer order, you can't change the order of the layers at run-time nor can you move or spawn actors to layers other than the one the actor is already on . . . if you want to achieve this sort of thing you need to set up the actors you need on each level and find some way of manipulating them (opacity for example) to make them appear to change layer position . . . or work out a way where a value change on one layer changes an attribute which triggers a spawn behaviour on another layer.
  • SocksSocks London, UK.Posts: 12,822
    edited October 2013 Accepted Answer
    @greyk50@gmail.com

    Here's my reply to a similar question posted a few months back, might be useful.


    Three layers in this order.

    1) Foreground character.
    2) Obstacle.
    3) Background character.

    Both the 'Foreground' and 'Background' are the same character, they follow the same rules, they move together as one . . . but they toggle their alpha channels on and off - so when one is on the other is off (and visa versa).

    So when you want the character to walk in front of the obstacle the Foreground character's alpha will be set to 1 (and the Background character's alpha will be set to 0).

    & when you want the character to walk behind the obstacle the Foreground character's alpha will be set to 0 (and the Background character's alpha will be set to 1).

    Here is a Gamesalad project I'm working on using this method:

    image


    . . . . . . .

    To automate these alpha channel changes place some 'sensors' around your obstacle, when the character collides with these sensors the relevant alpha channel changes are made.


    Hope that makes sense.

Answers

  • Thanks for the quick, insightful, and freaking awesome reply, so in this case, just want to know if this kind of gameplay still do-able with gamesalad? Please refer to the image below.

    image
    Hero can move 360 degrees, and still applying the z-index behavior. Because I would like all of the actor can move freely (any angle). Please advise, thanks!
  • mataruamatarua Auckland, New ZealandMember Posts: 854
    Totally is using @Socks method - he has just shown that - this 2D example above you would perhaps have to find the base of each object constrained to a Y value and then do comparison between the hero and the monster - the one with the highest Y makes the front layer alpha 0 and the other does nothing. Would that be right Socks?

    But it has a logic flaw as I see it - it only works on stationary enemies - this comes in to effect when you have many moving enemy actors overlapping and your hero and monsters only two layers. So it could mean you have to keep monsters on a grid of layers.

    --------------
    Hero
    --------------
    Monster in front
    --------------
    Object in middle
    --------------
    Monster at back
    --------------
    Hero
    --------------
    Background

    Just ideas anyway :)

    Thoughts @Socks?
  • SocksSocks London, UK.Member Posts: 12,822
    @matarua
    Maybe use the spawn layer function to move objects up and down layers . . . .?
  • mataruamatarua Auckland, New ZealandMember Posts: 854
    @Socks that is magic I know not.
  • SocksSocks London, UK.Member Posts: 12,822
    @Socks that is magic I know not.
    Lol ;)

    I just mean that when you spawn an actor you can define where it is spawned within the layer, so you might be able to use than functionality to dynamically shuffle your actors around, just a thought . . . .
  • mataruamatarua Auckland, New ZealandMember Posts: 854
    Cool :) The game style I was thinking of in my head was like Double Dragon perhaps - that might be a stretch too far.

    I am not sure how you would do if there was fisticuffs and 6 actors were overlapping.

    But I thought about it last night and came up with a solution but thought it had a big hole in it.


    Hero A
    --------------
    Monster 1A
    --------------
    Object A
    --------------
    Monster 2A

    ˅˄˅˄˅˄˅˄˅˄˅˄˅˄˅˄˅˄˅˄˅˄

    Monster 1B
    --------------
    Object B
    --------------
    Monster 2B
    --------------
    Hero B
    --------------
    Background


    The way above everything can be in front or behind.

    But I did thing where say we have a horizon level

    Top layer = Hero A + Monster 1A
    ----------------------------------
    Sub layer = Object A/B + Monster A/B (depends on Y value)

    Thinking now you already have the layer order as well to work with perhaps it could work with that as a variable added in.

    Hmmm, interesting...
  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2013
    Cool :) The game style I was thinking of in my head was like Double Dragon perhaps - that might be a stretch too far.
    @matarua

    http://www.deepblueapps.com/double-dragon-template/



  • mataruamatarua Auckland, New ZealandMember Posts: 854
    edited October 2013
    @socks that seems to do it with these actors sweet as - but what if there are 10 on screen? They say...

    "FULL layers, hero can go in front and behind and even in between enemies and also the enemies can go in front and behind each other."

    So greyk50@gmail.com if you want you get a sample project that has the code already done over at @DeepBlueApps for 25 Pound.
  • greyk50@gmail.comgreyk50@gmail.com Member Posts: 3
    edited October 2013
    Yep, will consider to do so, to me, basic actor behavior is a must have, I don't know why some people doesn't treat it as a big issue, I just can't live with this. Depth is the only thing that can create 3D illusion.

    However, thanks for the very insightful and helpful advise, @matarua and @Socks, you 2 are awesome, haha. Do you mind if I add you both as facebook friends? lol
  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    edited October 2013
    @greyk50@gmail.com, no offense but can you edit your post to clean up the language...

    Thanks! :)
  • mataruamatarua Auckland, New ZealandMember Posts: 854
    @greyk50@gmail.com here is better - use it a lot more than Facebook ;)
Sign In or Register to comment.