Zooming in/out and keeping the HUD ware it first started

ElemetAppsElemetApps Member, PRO Posts: 55
edited March 2019 in Help Wanted

So I have an app i'm making that has a map on it, you can scroll on it and zoom in and out. The menu button stays with the screen when scrolling. But when you zoom in, the menu button enlarges and slides off the screen, then you zoom out and it comes back in a different spot at the rite size. And this is going to be on different devises, so how do I make it to ware the button will stay the same size and on the top of the screen, ware it first started, on any devise. If you guys want to look at it, here it is.

[file removed by moderator]

Comments

  • ElemetAppsElemetApps Member, PRO Posts: 55

    Maybe something like a isolate a layer from all scene and camera movement
    like this guy is saying, http://forums.gamesalad.com/discussion/57361/isolated-ui-layer-in-gs
    What do you guys think?

  • IceboxIcebox Member Posts: 1,485

    @Elemet there is a tutorial on youtube by gshelper.com hope it helps

  • ammoniteammonite Member Posts: 9

    Thank you all so very much for the insightful and helpful posts. May you all have an excellent week.

  • bob loblawbob loblaw Member, PRO Posts: 793

    t-shirt booth's video is ok, but there's a better way to do it.

    i see you've used that zoom template as well (from denimshark?) that template is superb for anyone that wants a great zoom/swipe control (you've just put it up for free access - d'oh - mods should probably remove as denim shark is the owner and trying to make $ from it), but it needs a small amount of tweaking. including that you need to constrain the min/max x and y values on the zoom actor so it doesn't go off the screen accidentally and freeze up your scene. i learnt that from my current project after a bunch of testing.

    to lock the position and size of your actors, you need a bit of maths and tinkering with numbers to adjust, and you need to unlock each instance of an actor that you want to scale to the zoom, and put them on a non-scrollable HUD layer.

    basically, there's a couple of formula that work but this is the way i did it in my current work in progress. in each unlocked actor instance you will need the four behaviours:

    1- constrain self size height - scene.cameraSizeHeight-scene.cameraSizeHeight/1.18 - gives about 100 or so pixels height. tinker with the 1.18 until you get the height you want.
    2- constrain self size width - starting width relative to starting height - eg. if the actor is half as wide as it is high you would constrain self width to self height*0.5, if the width and height are equal, constrain self width to self height
    3. constrain self position x - scene.camera.size.width - scene.camera.size.width/1.07 - this will lock an actor to the left of the screen. tinker with the 1.07 to figure out what position on the screen you want. a number closer to 1 will place on the left edge, 2 should be middle, etc.
    4. constrain self position - scene.camera.size.height-scene.camera.size.height/12 - this will place your actor at the top of the screen. tinker with the 12 to change the position lower. same as 3. above, 1 will lock to the bottom edge, 2 middle, etc

    if you are locking actors to stay next to each other in the same proportions (eg. like score digits), you would use the same process above, but change the x or y constraint to be relative to the x or y position of the actor next to it (eg. for a score, you would use the above steps for the 1s digit. then for the 10s digit, you would change the constrain position self x to the 1s digit position x - self size x)

    hope that makes sense. see how you go.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    @bob loblaw This thread is four years old. I guess no one caught that until now but since the template is still for sale on GSHelper.com, I'll go ahead and remove the link to the file.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • bob loblawbob loblaw Member, PRO Posts: 793

    @tatiang said:
    @bob loblaw This thread is four years old. I guess no one caught that until now but since the template is still for sale on GSHelper.com, I'll go ahead and remove the link to the file.

    hahaa d'oh! i didn't see that, just the stamp on the last reply. not the first time i've been caught out by that.

    hopefully my advice can help someone so i don't feel like a complete so and so.

Sign In or Register to comment.