How scaling works

Started by nightmarer, Sun 11/04/2021 22:49:42

Previous topic - Next topic

nightmarer

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
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;
  }
}

Crimson Wizard

You can read Character.Scaling to get its current scaling regardless of whether it's set by hand or by walkable areas.

nightmarer


SMF spam blocked by CleanTalk