Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Guyserman82 on Sun 27/12/2009 22:57:56

Title: Scaling left to right
Post by: Guyserman82 on Sun 27/12/2009 22:57:56
Well, there are really two questions here. First, is there an easy way to scale from left to right, and if it is done with a walkable area, how can I have two walkable areas that are exactly the same, just activated in different conditions?
Title: Re: Scaling left to right
Post by: MrCheminee on Sun 27/12/2009 23:27:06
You can give each walking area another scale, so if you put two walking areas next to eachother with the first on 100 and the other on let's say 150, you will have from the left to the right other scalingproporties. Then you can put some more walking areas between them to smoothen the scaling, or a walkbehind object...
Title: Re: Scaling left to right
Post by: Khris on Sun 27/12/2009 23:29:07
You have to do it manually. In the room's before fadein event, call player.ManualScaling = true;, then set the scaling in the room's repeatedly execute.

An example: say you want to scale the player from 60% to 100% on a walkable area stretching from 10 to 290.
(100-60) / (290-10) = 40 / 280 = 1/7.

Thus:
  player.Scaling = (player.x - 10)/7 + 60;

About the second part of your question, I'm not sure what you're after, could you explain a bit more?
Title: Re: Scaling left to right
Post by: Guyserman82 on Mon 28/12/2009 18:50:43
Quote from: Khris on Sun 27/12/2009 23:29:07
You have to do it manually. In the room's before fadein event, call player.ManualScaling = true;, then set the scaling in the room's repeatedly execute.

An example: say you want to scale the player from 60% to 100% on a walkable area stretching from 10 to 290.
(100-60) / (290-10) = 40 / 280 = 1/7.

Thus:
  player.Scaling = (player.x - 10)/7 + 60;

About the second part of your question, I'm not sure what you're after, could you explain a bit more?
thanks, I'll try that.
What I mean when I say two walkable areas, is that if I were to scale left to right using a normal walkable area, I would want one area on if certain conditions were met. With your code, all I will have to do is have that code activate when those conditions are met.
Title: Re: Scaling left to right
Post by: Khris on Mon 28/12/2009 20:50:44
You can't have overlapping walkable areas, but all you'd have to do is change the area's scaling (if horizontal scaling was possible).
Title: Re: Scaling left to right
Post by: monkey0506 on Mon 28/12/2009 21:03:38
Although you can't have overlapping walkable areas, you are already using manual scaling so you could use the walkable area's scaling level as a variable to determine which functionality it should give. For example if you want the horizontal scaling initially turned off you could set the scaling level for the area to 0 in the editor. Then when you want to activate the horizontal scaling you could do:

  // activate horizontal scaling
  SetAreaScaling(WALKABLE_AREA_ID, 5, 5);


And then change the rep_ex code to something such as:

// room rep_ex
  player.Scaling = 100; // restore normal scaling if not on the area
  if (GetScalingAt(player.x, player.y) == 5) player.Scaling = (player.x - 10) / 7 + 60;


Per the manual SetAreaScaling accepts values from 5 to 200 so logically if you're using manual scaling then that could give you variables to indicate up to 196 different (virtual) walkable areas for the same actual area. That would mean that every character and object in the area would have to be using manual scaling, but it could work.