How would I move an actor to the position that the user touched?

How would I make it so when a user touched the screen the actor would move to the place that they touched. How would I do that?

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    You could say in a rule:

    When attribute game.Touched is False
    And
    When mouse button is down, change attribute game.Touched to true.

    In your actor you want to move:

    When attribute game.Touched is true,
    Interpolate self position x to mousePositionX
    Duration 0.2

    Interpolate self position y to mousePositionY
    Duration 0.2

    Timer : after 0.3 seconds,
    Change attribute game.Touched to false.

  • cousinjoshycousinjoshy Member Posts: 34
    You could say in a rule:

    When attribute game.Touched is False
    And
    When mouse button is down, change attribute game.Touched to true.


    What do u mean?
  • cousinjoshycousinjoshy Member Posts: 34
    Do u mean when I am not touching it the attribute game should be set to false?
  • cousinjoshycousinjoshy Member Posts: 34
    Nvm
  • cousinjoshycousinjoshy Member Posts: 34
    You could say in a rule:

    When attribute game.Touched is False
    And
    When mouse button is down, change attribute game.Touched to true.

    In your actor you want to move:

    When attribute game.Touched is true,
    Interpolate self position x to mousePositionX
    Duration 0.2

    Interpolate self position y to mousePositionY
    Duration 0.2

    Timer : after 0.3 seconds,
    Change attribute game.Touched to false.

    Ermm I don't understand the first part.
  • cousinjoshycousinjoshy Member Posts: 34
    @cousinjoshy

    Try this:

    http://www.mediafire.com/?rj8ognwvo43c5oj
    What am I downloading from this link?
  • SocksSocks London, UK.Member Posts: 12,822
    What am I downloading from this link?
    Are you having trouble downloading it ?
  • cousinjoshycousinjoshy Member Posts: 34
    What am I downloading from this link?
    Are you having trouble downloading it ?
    Nope. Should I just open it?

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

    Nope. Should I just open it?

    That's entirely up to you.
  • cousinjoshycousinjoshy Member Posts: 34

    Nope. Should I just open it?

    That's entirely up to you.
    Lol stupid comment I made. Thx it helped a lot.

  • cousinjoshycousinjoshy Member Posts: 34
    Also how would I make it go faster or slower?
  • SocksSocks London, UK.Member Posts: 12,822
    Also how would I make it go faster or slower?
    Take a look at the actor's rules.
Sign In or Register to comment.