Quote from: Khris on Tue 10/11/2020 15:20:37
In case it is not obvious (I was by no means obvious to me when I started to program): there isn't any special syntax involved here at all.
You can split that code into three lines:Code: ags int destX = player.x + 20; // this is a simple expression int destY = player.y; player.Move(destX, destY);
When you do this in one line instead, the Move() command still has absolutely no idea about the + 20 even existing. AGS will essentially do the three line version above, but internally.
The idea that the Move() syntax somehow supports or allows a "+ 20" here couldn't be further from what's actually happening.
It's the same withCode: ags if (complicatedExpression && evenMoreComplicatedExpression || someTruthyIntValue) ...
The if construct has no idea about the contents of the parens, and it doesn't care at all. The conditional expression is evaluated, and the final result is used to determine whether the if block is entered or not.
This is one of the things I learned very late into my foray into programming, long after I started to write AGS scripts. It's absolutely crucial to understand how to build algorithms from simple building blocks though.
Thanks as always for the explanation, i will study hard!

Edit: oh no sorry i was thinking about this player.DestinationX, or Y
Saw now you did something different.