how to create an object that cannot overlap?

0 favourites
  • 6 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • how to create an object that cannot overlap?

  • I think that adding the following conditions as sub events to on touched batao will fix that (if you delete the action as well/ move it to the sub events)

    1)touch.y is greater than or = arvore.y-(arvore.height/2)

    1)touch.y is less than or= arvore.y+(arvore.height/2)

    A)touch.x greater than arvore.x+(arvore.width/2)----->set acao to 13

    B)touch.x less than arvore.x-(arvore.width/2)----->set acao to 13

    2)touch.x greater than arvore.x+(arvore.width/2)

    2)touch.x less than arvore.x-(arvore.width/2)

    A)touch.y is greater than or= arvore.y-(arvore.height/2)-->set acao to 13

    B)touch.y is less than or= arvore.y+(arvore.height/2)-->set acao to 13

  • Sorry I'm not sure how to get that to format correctly.

    1) is the first sub event and it's conditions

    followed by it's sub events A) and B) that have actions

    2) is the second sub event and it's conditions

    followed by it's sub events A) and B) that have actions

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I did this for my tillage/planting system and it works perfectly, but with the trees it doesn't

  • What I posted checks involves checking the size of the object in relation to the touch positioning (assuming you are primarily concerned with the same objects not overlapping). height/2 makes sure that it is outside of any y that would overlap and width/2 for the x that may overlap. you may actually not want to divide it by 2.... either way, that's how I would go about it.

    it may also need to be on the event below. Using the objects height and width within the condition is the simplest way to do it.

    another way to do it is to destroy the object that is overlapping at a great z elevation and then set acao to 13 again (or whatever other value needs to be reset)

  • Subscribe to Construct videos now

    the sprites are the same size, in one place it works, and in the other it doesn't. Does not make sense

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