Hundreds of features to explore
Games made in Construct
Your questions answered
Popular & trusted by schools and Universities world-wide
Construct 3 runs in the browser & works offline
Students do not need accounts with us
Our educational partners
Free education resources to use in the classroom
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
I can make a physical object impulse towards mouse.x/y, but how do I compare mouse x/y and then apply variable impulse away from the mouse location on click?
example: the closer the mouse is to the object, the higher the impulse (limited to 10 maybe) and the farther away the less impulse (limited to 1 maybe)
Thank you!
Develop games in your browser. Powerful, performant & highly capable.
Use angle(mouse.x, mouse.y, object.x, object.y) and distance(mouse.x, mouse.y, object.x, object.y) expressions.
For example, you can try something like this:
Apply impulse clamp(200/distance(mouse.x, mouse.y, object.x, object.y), 1, 10)