Touch not functioning properly across multiple devices

I'm currently working on a game with support across all devices, and I can't get my objects touchboxes to function properly in any device other than the one I started in, iPad Landscape.

My code for the object involves setting my objects X coordinate to the game's Screen Width (through the Device attributes) divided by 2, and the objects Y coordinate to the game's Screen Height (again, through the Device attributes) divided by 2. This part of the code is basically putting the object in the middle of the screen.

What seems to be happening is that when you change devices in the viewer, the image shows up properly where it should be in relation to the new device, but if you click where the image is, nothing happens. For some reason, where you have to touch stays at whatever point it would be on the iPad screen, so if an iPad's dimensions are say (2000x1000), the object will spawn at (1000,500) - which as specified above, is half of the Screen's Height and Width, and when changed to a (1500x700) iPhone, the object's image moves to the point it should relative to the iPhone, at (750,350) - which is half of the new Screen's Height and Width, but where you touch stays at wherever it was for the iPad, at the point (1000,500). This happens even if you open the viewer starting in a device other than the iPad Landscape, it seems to always save the points it used for that.


TL;DR: Even though the location of the image changes across multiple devices, no matter what device you start in, the object's actual touch behaviors is always at a point relative to the iPad's screen size, and I believe this is because we started the project in iPad Landscape, like stated above.

Any help would be appreciated to help move the object's hitboxes to its proper location with the image, even if it means completely redesigning the code. Thank you!

Comments

Sign In or Register to comment.