How can properly set a camera's location at a zoomed layer?

Not favoritedFavorited Favorited 0 favourites
  • 7 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • Let's say I made a camera object that moves with arrow keys. Depending on some values I will create a box that consists of tiles at the top left corner of the screen, and depending on how small it is, I zoom the layer more. I tried to first have the camera object loaded off screen and after some calculations have its position set, then change the layer scale but the game doesnt zoom in where I want it to zoom. How can I fix this?

    cdn.discordapp.com/attachments/960278860161765436/1516747489837973636/test.c3p

    Tagged:

  • Hi.

    It's not clear what you want to happen with the camera.

    There's an error in the code you provided. I've highlighted it in orange in the screenshot.

    You need to place these screen extension requests in the middle. otherwise, they'll be executed 60 times per second after the first tap.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thank you for reminding me about the Fullscreen, although this wasnt the issue.

    I will provide an image to show what I want to happen the moment the layout begins, basically it zooms in on the grid.

    The camera object is calculated to move at the center of the grid

    This is what I tried to do but the game apparently zooms at the center of the layer and not where the camera object is. It does have scroll to behavior, and I dont know how to make the game zoom at the grid

  • If you want to scale from the edge of the layout, the camera view will stop at the edge. To prevent this from happening, enable this option.

    It's great that you provided an example; usually, that's all it takes to understand how to help.

  • Now how can I make the hud lock where it is? Bceause after I turned on that option the game indeed zoomed where I wanted it to zoom but the hud is at the wrong spot.

    Do I use a Pin behavior? Note that if I want to make the grid bigger I will add the option to zoom in and out with the mouse, and the hud should still remain at its intended location like in the example images above

    Smallest Grid I want should look like this (width and height to 3)

    The layer is scaled to 3

    Largest Grid I want should look like this (width to 50 and height to 44)

    Scale is 1

    I made these inside debug mode

  • Here's a simple example of zooming with the mouse wheel.

    You can adjust the zoom level yourself.

    I recommend building the user interface on layers that don't scroll and aligning them to the desired edge of the layout when they appear—as I showed in the example.

    fex.net/s/b2palxd

  • I've never used these before (Viewport and lerp), where can I read more about them? Could you also explain what you do with lerp? Thank you.

Jump to:
Active Users
There are 0 visitors browsing this topic (0 users and 0 guests)