Zooming

This forum is currently in read-only mode.
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • I'd like to have my camera zoom out when ever the player moves. The camera must zoom out based on the charcters movement. Please?

  • Use the set display zoom action or set layer zoom actions. You can base the zooming in/out on your character's movement speed using a simple formula, using time conditions or timers to do it incrementally.

  • Could you tell me how to do that? I've tried this: Set the zoom based on the charcters X and Y. That didn't work though.

  • You'll want to set the zoom based on the distance between the two. Try:

    Always

    Set zoom to dist(player1.x, player1.y, player2.x, player2.y)

    You're going to have to tweak the equation to get it to zoom the right amount, like multiplying it by some amount, but that's the expression you'll use.

    I can't remember, is zoom 50 smaller or larger than 100%? The value might be backwards.

  • I think he's looking for an almost acceleration based zoom; so when the player starts moving the camera zooms out slowly.

    You need to get the player's distance from previous position at some time interval (Say 100ms) and base your zoom on that. Create a global variable (or private tied to the character) storing the characters X (if its a platformer) every 100ms then checking against its previous position; that will give you "The distance traveled since the last update" and a number to base your camera zoom on.

  • You need to get the player's distance from previous position at some time interval (Say 100ms) and base your zoom on that.

    ...which is equivalent to it's speed, which Rich pointed out:

    You can base the zooming in/out on your character's movement speed using a simple formula

    So you just need to set the X and Y zoom ratios to something like 100 - player[movement].speed / 10. Something like that. Play with the numbers to get it exactly right. No need for anything more complicated.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I didnt even know about the [platform].speed property yet

  • I used acceleration based zoom for the 8-direction object in the same way Ash points out. It's really smooth and pleasant.

    add some modulation to adjust the speed of the zooming (current = current + (target - current)*modulation)

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