AriesDatuin's Forum Posts

  • 3 posts
  • That looks about right. Although there is a bound to layout behavior that seems more suitable for what you described.

    I'm not certain about the effects of the layout scale, but that should be easy to compensate for either way, as there is a layoutscale expression you can use as a multiplier if necessary.

    Thanks! I’ll try to post a capx up here. There seems to be quite a few people asking about pinch to zoom combined with smooth (inertia) panning / touch drag, while still being able to keep the image within the viewport / layout.

    I’m basically trying to create a fullscreen map with touch panning, pinch to zoom, and hopefully rotation, while still keeping it within viewport or layout bounds, and have hotspots that when clicked on have a scrollTo behavior. I’ll see what I can come up with.

  • Using an invisible helper sprite is perfectly acceptable and recommended for ease of use.

    Otherwise, you may use the viewport expressions to get the edges of the screen and use those as a condition to keep the scroll event from running past the layout edges.

    Haven't tried this yet, but combining this with clamp should keep the contents of the layer within bounds, correct or am I talking nonsense? Would this also take into consideration the current scale of the layout when zoomed in?

    X : clamp( Self.X, ViewportLeft(Self.LayerName)+Self.Width/2 , ViewportRight(Self.LayerName) - Self.Width/2)

    Y : clamp( Self.Y, ViewportTop(Self.LayerName)+Self.Height/2 , ViewportBottom(Self.LayerName) - Self.Height/2)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm banging my head on the wall trying to figure out how to keep the image from panning outside of the layout and adding some kind of smooth panning or inertia to it.

    Is there a condition that checks the image's edge or bounding box and have it stop panning if the the image is at edge of the layout so it prevents it form infinitely scrolling out of bounds?

    I can do this by placing a sprite and designating it as a camera with ScrollTo and BoundToLayout, but the example provided is referencing the actual layout instead of a sprite object.

  • 3 posts