Drag & Drop

Hi, I'm a Gamesalad noob, and I have a scene, and there is a bar on the top and a ball on it. How can I:
1. Disable the gravity before I press a "Drop" button.
2. Be able to drag it where I want and then press the drop button, and the gravity would be on again.
A bit like Amazing Alex but there would be gravity and stuff...

Hope you got my point :D

Thank you.

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited August 2013

    Hi @Taneli00

    First to say, you can't disable Gravity at run time (or enable it, for that matter). So in this case, maybe you could use velocity (although there are other options...)

    So something along the lines of the following:

    in your Drop button:

    Rule: When touch is pressed
    Nested in above rule: when scene.toggle is false
    Change Attribute scene.toggle to true
    Otherwise
    Change Attribute scene.toggle to false

    --

    Now in the rules of your ball:

    Rule: When scene.toggle is true
    Change Atribute self.Motion.Linear Velocity.Y to -180
    Otherwise
    Change Atribute self.Motion.Linear Velocity.Y to 0
    --
    Rule: When touch is pressed and scene.toggle is false
    Constrain Attribute self.Position.X to game.Touches.Touch 1.X
    Constrain Attribute self.Position.Y to game.Touches.Touch 1.Y

    Hope that gets you on the right track.

  • Taneli00Taneli00 Member Posts: 6
    Yes, thank you gyroscope. I'm using the accelerate for gravity. I'm just so used to call it gravity. I will test that thing out :)
  • Taneli00Taneli00 Member Posts: 6
    And what do you mean with "when scene.toggle is false"?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited August 2013

    That's a boolean attribute used as a "switch" which I happen to call toggle (because it toggles back and forth between off and on states).
  • Taneli00Taneli00 Member Posts: 6
    Ok, thanks.
Sign In or Register to comment.