How to "simulate" a balloon movements in the air.

scrapee_netscrapee_net Member Posts: 424
edited August 2012 in Working with GS (Mac)
Hello. I'm creating a balloons game for Kids, but I cant figure out how to make the balloons behave similar to a real balloon, that is something like, bounce in the air.

I created an image to better explain this:
image

I imagine that it would need sin and cos to do such thing.

Any ideal or sample for this?

thanks in advance.

Comments

  • scrapee_netscrapee_net Member Posts: 424
    anyone
  • skotleachskotleach Member Posts: 48
    edited August 2012
    Thinking on the fly here but...

    Create a scene with gravity, then intermiteenly accelerate at a direction of random(80,100)

    My thought is that the balloon accelerates up then stops accelerating, then starts again, which might make it look like it's bobbing upward. The random direction changes will cause it to move upward but occasionally shift left or right. I suspect it will take some finessing, but it may work.
  • BlazingApplicationsBlazingApplications Member Posts: 340
    edited August 2012
    Make two self attributes (both real)
    1) Start X
    2) Start time

    Add this to your balloons:

    Change:
    self.Start time = self.Time

    Change:
    self.Start X = self.Position.X

    Constrain:
    sin(( self.Time - self.Start Time )*30)*20+ self.Start x

    30 refers to how fast it goes left and right
    20 refers to how far left and right the balloon goes.

    Video:




    Have fun!!!
    -BA
  • scrapee_netscrapee_net Member Posts: 424
    edited August 2012
    Thanks @BlazingApplications. Thats looks to be exactly what I needed. Didnt try yet, but it should work.
Sign In or Register to comment.