I made a simple game for Android (to test the capabilities of the engine), in which control is carried out by tapping on the screen:
- click on the left half of the screen - the object moves to the left;
- click on the right half of the screen - the object moves to the right.
For such control:
- we get the coordinates from the Surface Coords node at the On Surface event, we take the X value from there (let’s call it TouchX);
- we get the width of the window from the Window Info node, divide by 2 - we get the center of the screen along the X axis (let’s call it CenterX);
- if TouchX> = CenterX, then move to the right, if not, then to the left.
When running Window (Krom) and HTML5 (JS) - it works:
When launched on a smartphone, the error is:
- the object always moves to the left (i.e. the condition is always False)
I have a suspicion that the comparison of different types (integer and float) is not correct (look at the value of Touch.Coord.X for windows and for android).
Any ideas how to fix this?
Or is it time to write an Issue on github?
P.S. The choice of orientation for the screen does not work, always the value “sensor” is set in the manifest.