Hello!
I tried my best to search the forum and internet but could not find an answer to this. So maybe you can help or have any advice :)
Is there a way to use variables to use as input for a "ray-cast" to detect hitboxes?
Let me elaborate on this one. I think its quickest to give a pseudo-code example.
Global Variables:
OldTouchX
OldTouchY
On any touch > set OldTouchX = TouchX
> set OldTouchY = TouchY
// This will save the "old touch position" after you are not in touch anymore. This way I can do the following:
On any touch release && OldTouchX is between Button.X-(Button.Width/2) and Button.X+(Button.Width/2) && OldTouchY is between Button.Y-(Button.Height/2) and Button.Y+(Button.Height/2)
// This way I can use a touches "end" rather than "tap" or "is touching" object to trigger events. This is a great behavior I couldn't find another way to accomplish.
The Problem
This works perfectly for rectangular elements! But is there a way to use variables to see if e.g. OldTouchX and OldTouchY are hitting an elements hitbox, rather than using "between two values"??
This way you could use this "detect if object has been touched on touch end" to detect circular or even free defined hitboxes.
Maybe also check out this other entry where we actually came up with this solution to solve the original problem of how to detect if an "object had been touched on touch end"
MISSION IMPOSSIBLE: HOW TO (FINE) TUNE "TOUCH > ON TAP":
construct.net/en/forum/construct-3/how-do-i-8/mission-impossible-fine-tune-150292
Any thoughts or help on this one?
Thank you <3 :)