How to make a draggable scaled layer?

Not favoritedFavorited Favorited 0 favourites
  • 3 posts
From the Asset Store
Create large maps with dynamic depth and precise sprite layering control in top-down games.
  • As the title suggests, I'm trying to make it, so you can drag the layout using a mouse, with the exception of the fact that the main layer "occasionally" zooms in and out, while the background layer stays completely still (and so does the front one (usually UI)).

    First, I tried using the "drag n drop" object method, but it didn't work. I tried everything and then said "duck it, I'm gonna find some help"

    I found an official tutorial explaining I should use global variables instead. I even added the Y thing (like the tutorial mentioned) and it works flawlessly. However, when I zoom out, it's very slow, zoom in like 5 times -- too fast. I tried everything (changing up the parameters, placing some math symbols, wrapping variables in brackets) but nothing works like needed, it either teleports or flies away, never to be seen (ok that's dramatic).

    I even found a forum, having the same question and I thought the problem is solved, me happy, case closed... but no. The Google drive link has expired and I can't even download the file. Turns out it's from over 9 years ago, so it didn't help me at all.

    Now I'm here... How can I drag the layer without it suddenly being too slow or too fast, while the stuff in the background is completely still?

    Tagged:

  • About scale and offset scroll specific layers, Now is easy to make in Construct 3, The Layer has many properties and expressions:

    • LayerScale(layer)
    • LayerScaleRate(layer)
    • LayerScrollX(layer)
    • LayerScrollY(layer)

    For Construct 2, If I remember correctly, c2 should contain these examples. If not, that's okay, you can check them out in Construct 3, which is also available in the free version.

    1. Touch: Panning
    2. Touch: Zooming

    Since these two samples only demonstrate specific gestures, you need to combine them if you want to both zoom and pan gestures.

    ===

    By the way, these three examples are also worth reading. They all apply drag and drop to practical examples.

    1. Hidden Objects
    2. Place Stickers
    3. Kitty Katcher
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • XHXIAIEIN Thanks for at least SOME help, but I can't quite wrap my head around the touch thing. I was looking to use the mouse cursor, not touch, and the examples (both on c2 and c3) only show how to scale a layout, not the layer.

    If I need to test any of these, I would need a touchscreen monitor for these.

    Can you make a project, where you scale the LAYER with Ctrl+wheel and you drag with the continuous left-click, and send it to me?

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