Autoscale character to simulate depth in 2D game

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By JuanDaniel

Hi,

is there a way to autoscale the character when he is near of the foreground in a 2D game?

For example, imagine the next scene in a 2D point and click game:

Character should appear bigger in the foreground than when he walks by the end of the scene. Can I control this without use code? Can I select the zones when the character should escalate progressively.

Thanks and kind regards.

:bust_in_silhouette: Reply From: Eric Ellingson

Here is a very rough idea of how to do it. I’m sure there are better ways, but you could maybe try starting with this: GitHub - e-e/godot-y-scale

The main idea is that you set points where you know what the scale should be, and it will try to figure out the inbetweens based on the distance between two known points, using the players y-position.

Thanks Eric! I will try it and I will comment the results. :slight_smile:

JuanDaniel | 2019-09-17 07:18

Thanks Eric! It works very well. I tried with polygons to select the area where the character should scale, but your approach is better.

JuanDaniel | 2019-09-22 18:04