Gradually Increase Attributes

Hi, I'm new to the forums and GS.

I am trying to build my first app from the ground up and I am doing good on my own, except one part. Is there a way to gradually increase various attributes (size and position), all at once? What I am trying to do is have the enemy have a visible view point. So when the enemy looks away or down the view point is smaller. When the enemy looks back up the view point gets larger, then looks away and gets smaller.

So far:
I have the view point as its own actor.
It starts small, then with a timer, after 2 seconds I changed the attributes of the size and position.

Now while that looks like what I'm trying to accomplish. It just pops up in the next position rather then smoothly transition to the new attributes. Then It stays there. I would like for it to go back and forth between the attributes every 5 or 8 seconds.

Any help would be appreciated.

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited December 2014

    Try this:

    When attribute self.size.Height=100
    Interpolate self.size.Height to 200 for 5 seconds

    When attribute self.size.Height=200
    Interpolate self.size.Height to 100 for 5 seconds

    That will transition between a height of 100 and 200 assuming that the starting height of the actor is either 100 or 200.

    You can do the same for width, position, etc.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • jsorr2jsorr2 Member Posts: 279
    edited December 2014

    Thats sounds confusing.

    If you want an actor to move up and down every few seconds, and changed size when its up, just write:

    2 attributes:
    OldPositionY(real)

    NewPositionY(real)

    Store the original position in OldPositionY.

    Store the new positon in newPositionY.

    Rule:
    If self position y=OldPositionY
    Change size to 50.

    Timer:
    After 2 seconds, Interpolate self position Y to newPositionY

    Rule:
    If self position Y=newPositionY
    Change size to 100.

    Timer:
    After 2 seconds interpolate (or move to) self position Y to oldPositionY

    You can interpolate its size too, which makes it grow bigger smoothly.

  • GamingtilDawnGamingtilDawn Member Posts: 104

    Thanks for the responses

    jsorr2, I think I understand 25% of what you suggested hahaha. If I do it that way would I have to have 2 attributes (old and new) for everything that I want to change?

    tatiang, that way seems to work when I tried it out. My only question for your suggestion is, is there a way to have it pause for a few seconds before it moves again? the way you suggested it constantly moves.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited December 2014

    To add a pause, add a timer to each rule. I don't quite understand the timing you have in mind, but this should give you some sense of how to set it up:

    When attribute self.size.Height=100
    Timer after 2 seconds
    Interpolate self.size.Height to 200 Duration 5 seconds

    When attribute self.size.Height=200
    Timer after 2 seconds
    Interpolate self.size.Height to 100 Duration 5 seconds

    In that example, the actor would pause for two seconds between size changes and each change would last five seconds.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • GamingtilDawnGamingtilDawn Member Posts: 104

    Thanks tatiang! I know it's a little confusing what I was trying to explain, but this actually helped me out alot!

Sign In or Register to comment.