Hundreds of features to explore
Games made in Construct
Your questions answered
Trusted by schools and universities worldwide
Free education resources to use in the classroom
Students do not need accounts with us
What we believe
We are in this together
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'd like to use math functions. i.e. math.distance(...).
Is there any way to access system expressions in scripts, or has anyone found a work-around?
Develop games in your browser. Powerful, performant & highly capable.
You can't call expressions directly from script. You can pass values in variables though as shown in the integrating events with script example.
In this case it's really not worth the trouble though. The expression is a single line of JavaScript:
function distanceTo(x1, y1, x2, y2) { return Math.hypot(x2 - x1, y2 - y1); }
The integrated event style is how I've been going about it, but I do feel like sometimes it creates more complexity.
Thank you, sir