Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: nightmarer on Sun 11/04/2021 22:49:42

Title: How scaling works
Post by: nightmarer on Sun 11/04/2021 22:49:42
Hello.

I am trying to create a function to make my player to change his view, but as the view it has not the same size than the Normal view I need to move this new view to place so there won't be a gap from one to another. If I do it in a room without scaling that is easy, but the problem happens when the character is in a room where there is scaling, because the distance from one view to another changes.

I would like to know how this scaling works, because if I understand how it works I would make it work in any place of the walkable area.
Also I would like to know if there is a way to get the actual scaling where the player is, so then I would be able to apply a calculation.

This is how it works. There is another method who sents first the parameters, and the second option in parameter direccion sets back to the first position.

Code (ags) Select
static void Actions::Correcciones(Character *personaje, int x, int y, Direction direccion) {
  if (direccion == eForwards) {
    personaje.x = personaje.x + x;
    personaje.y = personaje.y + y;
  }
  else {
    personaje.x = personaje.x - x;
    personaje.y = personaje.y - y;
  }
}
Title: Re: How scaling works
Post by: Crimson Wizard on Sun 11/04/2021 22:52:45
You can read Character.Scaling to get its current scaling regardless of whether it's set by hand or by walkable areas.
Title: Re: How scaling works
Post by: nightmarer on Sun 11/04/2021 22:57:05
Thank you!