How do I make an upper Sprite cover a lower Sprites?

0 favourites
  • 11 posts
From the Asset Store
A set of 10 pixel art animated magic effects with icons. 2 Fire, 2 Earth, 2 Wind, 2 Water, Portal, Explosion.
  • I am trying to make a top Z order Sprite cover lower Sprites so they are no longer selectable with the mouse or touch.

    Basically, I have blocks that are normally selectable that I want to make them impossible to select when a specific Sprite is above them visually. Whether the Sprite is a transparent mask or a solid object.

    It seems like using the Z order is the most obvious solution, but I am open to suggestions.

  • Or with an instance variable?

  • I'm not sure I understand what you mean. Is that a question or a suggestion?

  • On click, check if the object is overlapped, if so ignore the click.

  • Great! I am very new to this so I will try experimenting with Booleans.

  • I am having trouble understanding the Booleans and getting them to function as I would like.

    Also, where do I place them? As a condition or an action?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You would set the instance variable as an action like is moveable to false

    Then you check condition boolean is NOT set (you invert with a right mouse click)

    Or you make instance variables with numbers or letters - her you check condition objSprite variable = "moveable"

  • I am having the hardest time making something false change to true.

    I have the instance variable set to false and I have it named. Where do access the action? It is not available in under 'system'. When 'sprite1' is overlapping 'sprite2', I want the Boolean to change values, but I cannot find the action.

  • You find it in your object_Sprite

    it's like that with all instance variables

  • Event: Your Upper Object -> Is overlapping another object -> Your Object below

    Action: Your Object below -> Toggle Boolean (true)

    -> Else: Toggle Boolean (false)

    Then take that Boolen as another condition to your touch event, so it only takes place when that boolean is true:

    Condition: Your Object below -> Is boolean instance variable set

    This condition will check if its true, if you want to check for false you have to invert that condition.

  • Wow! I can't believe I never looked in the object_sprite. Thank you for the help.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)