SOLVED : How to see if there is an object BELOW

0 favourites
  • 8 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • I am placing structures on my game map via a click event. So when you are ready to put an item down it should not be on TOP of another object.

    For example you cannot build 2 towers in the same position.(x)

    I can check to make sure that it is not overlapping and that works fine. But if I hover over another structure ( it is not overlapping ) then I can build the structure there : ) So.... basically I need to see if there is another structure BELOW the mouse : )

    Any thoughts? Maybe in the morning I will get up and I will see it, but at 1 a.m. it is eluding me :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That's what families are for! Buildable objects should be in a family, then you can simply do this:

    + Mouse is not over Buildables

    Do stuff

    If you are dragging objects, make sure to filter that one out first before checking for other objects. Can be done with control variables; assign a variable whenever you pick an object up and clear it whenever you place it.

  • It is not a MOUSE OVER....

    It is a "MOUSE ABOVE"


                                    X <-- Mouse Locaiton



    Does that make sense?

    If the mouse is above ( Y axis )

  • How about comparing Tower.Y with Mouse.Y?

    If (Mouse.Y < Tower.Y) the mouse is above the tower.

  • When you place a tower does it get placed where you clicked or does it drop down to the ground level?

    You could use an invisible sprite as a detector. Make it as wide as the tower and use some high number for the height. Then position it to the mouse and check it for overlaps with other towers.

  • It drops to ground level. Here is the file to see the project.

  • SOLVED: I used RoJo Hounds invisible sprite! Thanks!

  • hello there,

    could somebody tell me how can I do a procedural game like SKI SAFARI ( ) is there any template or something else?

    thanks for your help

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