Hello! Thanks for another amazing tutorial! I have a question that feels like should have a simple answer but it is not coming to me...
When declaring the initial _x _y variables, you include "(argument0 - x)" and similar. However, argument0 *is* x, so "(argument0 - x)" will always equal 0, right? Of course, this assumes the instance calling the script is the one that a collision check is being run for.
However, if a second instance calls this script in order to run a collision check on a different instance, then "x" and "argument0" in the script refer to different x values... Wouldn't that break the script? I just can't think of a use case where you would want this? Am I missing something?
Edit: I may have figured it out, it's to allow for a collision checks outside of the bounding box? Like when you want to determine if a moving object will collide given its current velocity?
Viewing post in Converting TDMC to use Tiles comments
Exactly. It's pretty rare that you are checking a collision at your exact position, so the argument passed in is usually your position + an offset. But more importantly is that we are combining this with bbox_ variables. Since bbox is also a variable that is always "relative" to the x position of the calling object, combining it with the offset gives us final range of tiles that needs to be checked for collision.
Cheers! I think what confused me was the conversion of the script into the 2.3+ format. I replaced argument0 and argument1 in the function declaration with x and y (as that's what you had in the @param comments) and that changed the x and y already in the script to be script variables instead of instance variables (and thus, would always result in zero for the aforementioned calculations). All good now!