Now to the fun part. After some thinking and tinkering I figured that, since I’ll deploying the game to an unknown lot of different resolutions (think android devices and then iOS ), I can’t just define a couple of intervals on the xx axis and check where the click/tap position fits, I need something a bit more clever than that.
So I came up with 2 possible ways to tackle this problem, but I don’t know if there is a third one or which one is the “proper” one in terms of effort/result/performance. So I’d like to know what you guys think about my ideias and if there is a better way to do this?
Option one is an “easy mode” solution: Create 2 “invisible” GUITextures, hook click/tap events on them, deploy a little “auto-scale, auto-position” function to keep up with resolution changes and done. In case you are wondering, the “center” action will be the default one, so I only need to specify the other two
Option two is a bit more elaborate, and I don’t have all the info I need to implement it:In a nutshell, I’ll measure the screen’s width (since height is irrelevant for my purpose), divide width/3, figure out how many pixels I have in each section (here is where it get’s tricky), map an xx interval to each set of pixels, something like for pixels=0-200, x goes from 0 to 30, for pixels 201-301, x is 31 to 61, etc.
This seems a bit more complex then option 1 and I need to know how much does xx variates per pixel(s).
Edit: My purpose is to figure out a way to define 3 screen areas, that are not visible to the user/player and that will trigger specific actions when acted upon. My two suggestions are for the implementation of a procedure that allows the required mechanics while beign agnostic of screen resolution.
I apologyse if any of my approaches is blatantly daft or a exuberant display of ignorance over the subject matter, but I’m still learning. Thus I feel that is more interesting to formulate the hypothesis and see it corrected by someone more experient, than just asking for the solution to problems we don’t fully understand
Thanks in advance for helping!