How do I check Touch over object (as if collision)?

0 favourites
  • 7 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • Title should say it all. However, as having an object follow Touch.X and Touch.Y to detect collisions is laggy (the touch cursor lags behind). If I could detect Touch on collision with an object, that would be awesome. I have searched the forum for this data and cannot find anything related, or I do not know what I am searching for. Thank you!

  • I'm afraid I'm not sure I fully understand the problem you're having. To trigger the On Object Touched and Is Touching Object the Touch object already uses the object's collision polygon. So, touch on collision with an object is already instantly returned. The laggy cursor symptom you mention sounds interesting because the cursor must have been made using your own code - so this might be where your problem is... Have you got a capx you can post that shows the problem you're trying to fix?

  • I mean when I touch something, I want to drag it elsewhere, and as it's dragging, while the touch x and y is over a new place, it should read from that object. but it can't be the sprite that does the detecting because if it's over two things then it's trying to do both, it has to be a 1x1 pixel perfect collision.

  • Are you looking to drag a sprite and then check whether or not that sprite collides with another object? Or, are you looking to see if the touch.x and touch.y overlap a 2nd sprite whilst dragging a 1st sprite around?

    A touch event can be detected by many different objects simultaneously, as long as those objects have collisions enabled.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes, as soon as Touch.X and Touch.Y are overlapping an object while dragging, I need it to store the UID and various data about that object. I know there are other ways of doing this, but I didn't know if there were associated actions or if I have to be a little more savvy with coding it?

  • I would add the objects you're interested in checking the touch for into a family with a family variable that is set as a different value for each sprite. Then while the touch is dragging, check for another touch event in the family - you can then use the family variable to filter which object was touched. Things like UID are then easy to get. Hope that helps.

  • This is the first post I've been able to find with someone talking about touch control and collision so I'm hoping someone can help with my similar problem. I have set up a game where you drag a character around the screen with your finger. I need walls to stop the movement of the character (like if he was going through a maze) but for the life of me I cannot figure out a way to do this. I'm new to using this program and so much of the collision detection in this engine seems to be set up with using Solids and then a movement behavior but controlling things with touch seems to completely ignore solids.

    All I want is a way to stop the sprite's movement like it does using any of the other control types. I've tried using set position command to make the object bounce back a bit but if it collides, but it looks really janky and doesn't always work right. Any help that can be provided would be greatly appreciated.

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