GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Question on making an actor "jump"

bartvicicbartvicic Posts: 14Member, PRO
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 Posts: 11,751Member, Sous Chef, PRO, Senior Sous-Chef
    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 Posts: 656Member

    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.Posts: 12,822Member

    @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.Posts: 12,822Member
    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 Posts: 586Member

    Have you tried to use interpolate? This might work

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

    @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 Posts: 14Member, PRO

    Solved! thank you for helping :)

Sign In or Register to comment.