How do I test if an object is clicked?

0 favourites
  • 6 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 need to make it so that when an object is clicked and held, it goes to the position of the cursor until it is released. The reason I am not using the drag behavior is because I only want the X axis to move to the cursor and not the Y.

    Tagged:

  • If it's always on object clicked then you can use mouse is over object and mouse button is down, set object to mouse.x. When you release mouse button it won't be true so will release the object.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Can you show me the JavaScript code to see if the mouse is over an object because I don't know how to do that. Thank you so much!

  • Can you show me the JavaScript code to see if the mouse is over an object because I don't know how to do that. Thank you so much!

    You don't need Javascript to do that,

    You can create a sprite and make it a solid colour and make it invisible.

    In the event sheet use:

    Every tick --> set newsprite to cursor.X

    cursor.Y

    newsprite is overlapping

    object of choice --> do something

  • I know that I don't need to use javascript but I want to because Event Sheets are too easy. I want to program with Javascript because I am looking to go into a career with that. Thank you for your response though. I just want to know how to see if a mouse is over an object.

  • I know that I don't need to use javascript but I want to because Event Sheets are too easy. I want to program with Javascript because I am looking to go into a career with that. Thank you for your response though. I just want to know how to see if a mouse is over an object.

    I recommend if you want to look at JS I recommend you go onto Codecademy as you are starting in the deep end. Starting JS with construct 3 is quite hard - Keep trying though and you will get there!

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