Change actor size based on screen location

mainsourcemainsource Member Posts: 19
edited November -1 in Working with GS (Mac)
I'm trying to get my actor to change sizes based on the location on the screen.
I tried adding a rule that checks for the y axis position and then changes the size, but its not working. Any suggestions?

Comments

  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    I've done something like that using the Constrain Attribute behavior.

    So if you want the actor smaller the higher up it is, then you can do something like this with the Constrain Attribute behavior.

    Constrain Attribute: self.Size.Width to cw*(1024-self.Position.Y)/1024 where 'cw' is some constant that is the normal width of your actor.

    Constrain Attribute: self.Size.Height to ch*(1024-self.Position.Y)/1024 where 'ch' is some constant that is the normal height of your actor.

    Of course you can play around with your numbers but the equation just scales the actor to some percentage according to its vertical position. 1024 is just some number that I used that looked okay. The larger that number is the less the position of the actor will affect the scaling.

    Note: If you have a large scene then you may need to include the Camera position in the calculations.
Sign In or Register to comment.