I'm trying to create an analog stick that works with touch screen devices. An issue I can't seem to get around though is the scrolling motion.
In the version I have uploaded, the stick is moved on the HUD layer, when the users touches the HUD the stick moves to the touched position. (This also works with mouse)
When I start the game in full screen (Scale) and click, the analog doesn't position itself correctly, its almost as if the parallax has failed.
Any help to why this is happening would be greatly appreciated.
Develop games in your browser. Powerful, performant & highly capable.
I've tried a few things out.
If I set the full screen to crop the touch device works as expected
If I set the full screen to anything else then it seems the touch device isn't pointing where I click.
I have tried playing with the scale rates with no success. Any help would be greatly appreciated
Having no luck here, testing everything from scale rates, to moving the objects to different layers.
I worked out it has something to do with the full screen and touching the a layer with 0,0 parallax. Its as if the screen warps itself on a different parallax.
If you download the capx, just click anywhere and you'll see what I mean
Richard, instead of using Touch.AbsoluteX and Touch.AbsoluteY, have you tried using Touch.X("HUD") and Touch.Y("HUD")? These give you X and Y co-ords that are adjusted for the scale, parallax, etc. of the specified layer ("HUD" in this case?
Here is a capx that works (I think)
Docs on the touch object including the Touch.X("Layer") and Touch.Y("Layer") functions can be found here.
Works perfectly now, I've read through the touch documents 100 times yesterday pulling my hair out for how to restrict touch to the touch layer. Don't know how I missed it.
Thanks for the advice