Bouncing Cloud

sessiensessien Member Posts: 41
edited November -1 in Working with GS (Mac)
Hi,

How can I move a cloud up and down slowly.

I want to get the effect of gently floating. I have tried so many things.

Thanks,

Sema

Comments

  • JPickardJPickard Member Posts: 477
    I did something similar for my game. I found it in a template in the New section of GS, but I can't refind it right now so I'll try to reproduce it here:

    _______________________________________

    In the cloud actor:

    First create 2 Integer Attributes:

    whatdirction
    wave

    (leave them at 0)

    _______________________________________

    Timer:
    __every 0.25 seconds --> (run to completein UNchecked) (this number can change to what you want)
    ____change attribute: Self.wave --> to (self.wave+1)%2

    Rule:
    when all conditions are valid
    attriibute --> self.wave =1
    +
    attribute --> self.whatdirction = 0
    ___move
    ____direction 225 --> relative to actor --> move type: additive --> speed 100
    ______(both those numbers can change depending on what you want)

    _______________________________________

    Rule:
    when all conditions are valid:
    attribute --> self.wave =0
    +
    attribute --> self.whatdirection =0
    __Move
    ____direction 135 --> relative to actor --> move type: additive --> speed 100
    _____(both those numbers can change depending in what you want)

    _______________________________________

    Rule:
    when all conditions are valid:
    attribute- -> self.wave =0
    +
    attribute --> self.whatdirection =1
    __Move
    ___direction 45 relative to actor --> move type: additive --> speed 100
    _____(both those numbers can change depending on what you want)

    _______________________________________

    Rule:
    when all conditions are valid:
    attribute--> self.wave =1
    +
    attribute --> self.whatdirection =1
    __Move
    ____direction 315 relative to actor->move type additive --> speed 100
    _____(both those numbers can change depending on what you want

    _______________________________________
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    sessien said:
    How can I move a cloud up and down slowly.

    Try placing a constrain attribute behavior in the cloud actor:

    Constrain Attribute: self.Position.Y To: 250-20*sin(self.Time*60)

    250 is where the actor will start (in the Y direction). You can fiddle around with the numbers until you get the effect you want.

    Be sure to use the drop-down menu in the expression editor to get 'self.Position.Y", 'sin' and 'self.time'. (Don't just type them in.)

    Hope that helps!
  • JPickardJPickard Member Posts: 477
    Well, that's a tad easier. ;)
  • sessiensessien Member Posts: 41
    The cloud bounces to the left. I am tinkering with it.

    Thanks.
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    JPickard said:
    Well, that's a tad easier. ;)

    Yes -- the joy of math!
  • sessiensessien Member Posts: 41
    Te constrain works like a charm.

    Thank you both very much.
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    sessien said:
    The cloud bounces to the left. I am tinkering with it.

    Thanks.

    You might need to change it to self.Position.X and 250+20*cos(self.Time*60)
    (Maybe its in a different orientation than I assumed.)

    EDIT: Oops -- looks like you resolved it while I was posting.
  • sessiensessien Member Posts: 41
    sessien said:
    The constrain works like a charm.

    Thank you both very much.

Sign In or Register to comment.