Community

SCI Programming => SCI Community How To's & Tutorials => Topic started by: Cloudee1 on June 04, 2015, 11:41:53 AM

Title: SCI1.1 Scaling the Ego
Post by: Cloudee1 on June 04, 2015, 11:41:53 AM
There seem to be two major scripts that are used for scaling: Scaler.sc and ScaleTo.sc.

Scaler appears to be the script that we will want to make use of in order to scale the ego (and presumably other actors as well) depending on where they are along the y axis. So that is the one we are going to focus on for now.

As with most functionality, to make use of it, you will need to use the scaler script in your room. So like always, up at the top where the other uses are defined add in:
Code: [Select]
(use "scaler")

And now assuming that you are going to want the ego to scale, we need to add the setScale to the ego. Presumably from the point of initialising the room, even though really it could be applied at any point. The syntax is really pretty simple. The paramaters that are sent accross represent the Front size, the Back size, the Front Y and the Back Y.

So as long as the ego is between the front and back y it will take on a size between the front and back size, relative to where it is between the y's. In the public instance of your room, where the ego is inited go ahead and change that line to:
Code: [Select]
(send gEgo:init()setScale(Scaler 110 85 190 72)) //  theFrontSize theBackSize theFrontY theBackY

And there you have it, the ego will now scale as you move up and down the screen. You can play around with the values to get the ego to fit the room scale making the scaling more dramatic or subtle as you see fit or changing it up as the ego moves down the screen he gets smaller instead of larger. The code above is not a really huge change, an example of it's result can be seen in this screenshot

Title: Re: SCI1.1 Scaling the Ego
Post by: MusicallyInspired on June 04, 2015, 11:54:00 AM
Thanks! I was wondering about this along with palette cycling! :)
Title: Re: SCI1.1 Scaling the Ego
Post by: troflip on July 12, 2015, 10:59:31 PM
Is anyone seeing that the ego's vertical movement slows down dramatically when any scaling is applied?

[edit:]
Well, in addition to that (yStep goes from 2 to 1 when any scaling is applied... this code is in Actor:doit, when the scale signal is set and there is a mover), the scaleSignal remains non-zero even when you go to a new room (the scaler property is set to zero by some code though - haven't found that yet). So in the room after a room in which you had a scaler set, the ego will stlil have yStep = 1 even though no scaler is set.  :(