SQOTD Alpha, layers, overlap ?

beaudoin_nbeaudoin_n Member Posts: 184
Stupid question of the day alert !

Yes sorry about that, i had a lot of advancement on my game today, i set up my actors simple as having color and text being the normal actor square.

Now sometimes when they overlap each other i see the one i am moving, other times it gets hidden behind what it moves.

Is this something to do with Alpha (which i don't have a clue what it does)
Having some way of setting up actors ?
Or other ?

As far as i know there is nothing special about an object versus the other since they are copies (just color and text differ)

Thanks all :)

Comments

  • rebumprebump Member Posts: 1,058
    If manually placed actor instances, make sure you have them on appropriate layers of the scene.

    If spawning, make sure you spawn them appropriately in front/behind of spawning actor's layer or the layer itself (they are settings in the spawn command).

    I'm guessing it is the second issue as most who are new don't get into the layers much from the start. I could be wrong though, so adjust accordingly.
  • rebumprebump Member Posts: 1,058
    The "alpha" setting of an actor (or image in a paint program) determines its transparency (more transparent as the setting goes toward zero) or opaqueness (as the setting goes toward one).
  • beaudoin_nbeaudoin_n Member Posts: 184
    Thanks rebump,

    Where is it that i can see the layer they are on ?
    I put them all on the grey part and then i move them to the play area so they are instances that are added. ( i per actor) is this the right way to do this ?
  • rebumprebump Member Posts: 1,058
    Well, if they are all hand placed and you don't know about the layer area, then they are all likely in the same layer (the default background one). So it may be a crapshoot as to the order that each actor is instantiated by the GS game engine (i.e. one actor could be on top the first run and not the second).

    In a scene, at the top of the area on the left you will see "Game" and "Scene" bar buttons. Click "Scene" and then the layers show up. You can add layers with the "+" (and remove with the "-"). You can then drag actors between the layers. They are top down with to being the layer closest to the camera (i.e. the viewer/player of the app). So "background" should stay on the bottom.

    You could create two more on top of "background" called "EnemyLayer" and then "PlayerLayer" placing the actors appropriately. Then the player will always be on top. Your collisions should still work in such a situation.

    When you add scores, HUD/map, messages, you usually add another layer (or two) on top of all the others and call it "Scores" or "HUD" or whatnot.
  • beaudoin_nbeaudoin_n Member Posts: 184
    i just want the selected one to appear on top of the others.. how do i make that happen ?
  • rebumprebump Member Posts: 1,058
    Not any easy way I know of. I don't think layer (or Z position) is an attribute of an actor. You would need some trickery to have a "GameItems" layer and an "ActiveItem" layer and promote/demote the currently selected item between them when selected/not-selected (using destroy/spawn) if you truly wanted the selected item to always appear above the rest.

    Another (probably better) way would be to have a spawner object that controls the selected actor and by control, I mean when one of the actors (i.e. a game piece) is selected, save some attributes, destroy it, and then have the spawner re-spawn (using the saved attributes) the actor to "just behind" the spawner. Having the spawner always spawn the actors initially as well as managing the currently selected actor will ensure the lastest spawned actor to always be on top.

    The downside to these two methods would be how do you retain a mouse/touch control of the selected actor between destroy/re-spawn.

    Maybe there is another way that others have bumped into? I'm still a bit new to the engine as well and may also just be dense at the moment! :-)
  • beaudoin_nbeaudoin_n Member Posts: 184
    Man this is complicated....

    :(

    Let's hope it won't prevent people form playing
Sign In or Register to comment.