HTML5 screen / touch position problem

arcticsunrisearcticsunrise Member Posts: 159
edited November -1 in Working with GS (Mac)
Hi Guys i was just about to publish my app to the appstore and html5 and i noticed a little error and was wondering on some advice/help

Ive got a zoom button and several other buttons next to it. When you zoom out (interpolate) all of the buttons also move and also increase in size so that they are still the same size in the same position.

However in the html5 version when zoomed out (i.e screen size is double) then it seems i cant click on the buttons anymore

Its fine in gsviewer and adhoc so its just in the web preview / html5. I obviously need to modify some code but not sure what to do

If it helps it also seems to move the screen across and up becuase my actor on touch works about x pixels and y pixels out (not sure of exact number) so perhaps its the origin that isnt quite lining up right - although collision etc and everything else in the game is fine.

Im just trying to make sure its all ok before i upload as its for a client

Thanks a lot

Comments

  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Here's a possible work around for the HTML5 version. You could have an invisible actor called mouse pointer (or something). Constrain this actor to the mouse x and y with camera offsets as shown in the cookbook tutorials. Then in the the menu buttons have a rule that says:

    (ALL)
    When actor overlaps with mouse pointer AND
    When mouse button is down

    blah blah blah

    Hope this helps.
  • arcticsunrisearcticsunrise Member Posts: 159
    Thanks that would work for the buttons i think but its the fact then when you now touch (click) the actor it doesnt register - but if you touch roughly 100 pixels x and 50 pixels y away it thinks you are touching it so for some reason the click input area of 0-960 has moved so this is probably why the buttons cant work because they are in fact on the top of the screen and because of the offset i cant actually click them

    I might have to upload so it can be looked at / maybe ill send to support
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    if you try my method with the mouse pointer actor visible does it follow the mouse pointer accurately in HTML5? If so it should detect the overlap with the button correctly and "mouse button pressed" is completely independent of mouse location. Seems like it should work for you if the mouse pointer actor is accurately containing to the mouse. You should be able to use this method for any actor. Not just buttons.
  • arcticsunrisearcticsunrise Member Posts: 159
    just putting in an actor with a crosshair picture and giving it 2 constrain rules shows up fine in gsviewer - however in html5 when i move the mouse the actor appears as if it was relevant to the original screen size, it starts fine at 0,0 but as you move away and put the mouse in the top right corner the actor is dead centre of the screen and all various in between

    so its my actual camera resize thats causing a problem or when its resized and the screen is made twice as big then the touch position in html5 isnt doubled also

    on the iOS device its fine - so its just through the web preview

    thanks for the help btw :-)
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Obviously the best solution would be to have GS fix the bug. If your client needs this soon you could try this:

    in your mouse constrains try this for x:

    constrain to "scene.camera.origin.x + (mouse.position.x*(scene.camera.width/480))"

    try this for y:

    constrain to "scene.camera.origin.y + (mouse.position.y*(scene.camera.height/320))"
  • arcticsunrisearcticsunrise Member Posts: 159
    thanks mate ill try that in the meantime - client really needs for teh weekend so ill try support as well

    if i could remove stuff from the arcade after then id just try publishing to html5 just to check if its actually a bug in the web preview in the creator and not in teh actual html5 finish - but i want it right before i show the client.
  • arcticsunrisearcticsunrise Member Posts: 159
    scitunes said:
    Obviously the best solution would be to have GS fix the bug. If your client needs this soon you could try this:

    in your mouse constrains try this for x:

    constrain to "scene.camera.origin.x + (mouse.position.x*(scene.camera.width/480))"

    try this for y:

    constrain to "scene.camera.origin.y + (mouse.position.y*(scene.camera.height/320))"

    it does mean that on the initial start the mouse actor is properly under the mouse but the click etc is still offset so it must be a strange bug.

    Its tricky cos i have a scrolling side level - physics shooter so camera origin changes a lot

    game is fine if you dont zoom

    ive mailed support with a zip of my gs project files

    appreciate your help btw thank you
  • arcticsunrisearcticsunrise Member Posts: 159
    might try it in 0.9.8 and see if the problem still exists
Sign In or Register to comment.