Question on making an actor "jump"

bartvicicbartvicic Member, PRO Posts: 14
edited March 2016 in Working with GS (Mac)

I am currently trying very desperately to make something work in my game. Here goes: I want to have an actor change its speed to say, 300 (it has to change directly to that amount and not accelerate, otherwise i would have used the accelerate towards behavior) , whenever i touch the screen, and make it to travel towards wherever i pressed. When it has that speed (of 300) and direction (toward where ever i pressed) i want it to slow down by setting the drag to say, 100. The problem here is, that i dont know what formula to use for the linear velocity x and y. I will be sooo grateful if someone will solve this for me. Thank you for your time :)

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited March 2016

    Have you tried using the Change Velocity behavior? The direction would be the vectorToAngle of the touch X and Y position attributes, relative to scene.

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

  • RossmanBrothersGamesRossmanBrothersGames Member Posts: 659

    Yes I think tatiang is right if I understand what you are describing. If you want to move to a point on the screen then you don't want to use linear velocity, you want to use the angular velocity which is controlled by the Change Velocity Behavior.

  • SocksSocks London, UK.Member Posts: 12,822

    @RossmanBrothersGames said:
    Yes I think tatiang is right if I understand what you are describing. If you want to move to a point on the screen then you don't want to use linear velocity, you want to use the angular velocity which is controlled by the Change Velocity Behavior.

    Angular velocity controls rotation rather than liner movement.

  • SocksSocks London, UK.Member Posts: 12,822
    edited March 2016

    Like tatiang says, use Change Velocity . . .

    When mouse button is down:
    --Change Velocity

    Direction:
    vectorToAngle( game.Mouse.Position.X - self.Position.X , game.Mouse.Position.Y - self.Position.Y )

    To set the Drag to 100 simply open the Physics attribute for the actor and enter 100 into the Drag value.

  • AngryBoiAngryBoi Member Posts: 586

    Have you tried to use interpolate? This might work

  • SocksSocks London, UK.Member Posts: 12,822

    @AngryBoi said:
    Have you tried to use interpolate? This might work

    Interpolate doesn't use the physics engine so will not be effected by drag.

  • bartvicicbartvicic Member, PRO Posts: 14

    Solved! thank you for helping :)

Sign In or Register to comment.