Stuck with actor movement.

jigglybeanjigglybean Member Posts: 1,584
edited November 2013 in Working with GS (Mac)
Hi all
I am needing some help how to make this work as it has been killing me for days!

I essentially want the user to be able to hold the actor(when touch is pressed) then drag the actor around the scene to shoot. Like in this example -


can anyone shed some light on how to make this work? thanks!

Like Balls? Then click here! We've 100 coming soon

Best Answer

  • SocksSocks London, UK.Posts: 12,822
    Accepted Answer

    I made 2 rules . . .
    @jigglybean

    You really only need 1 rule:

    When touch is pressed:
    Constrain self.pos X to mouse X
    Constrain self.pos Y to mouse Y

Answers

  • DaGreatnessDaGreatness Member Posts: 82
    edited November 2013
    @jigglybean All you have to do is, if you want it to be touch enabled. You will have to use the behavior that says, Touch. and then put it in a rule

    Rule:
    If touch is pressed
    Do
    whatever way you want it to go from the on screen controls that you have.
    Also add the fire actor in the DO as well


    Hope it helps man
  • jigglybeanjigglybean Member Posts: 1,584
    Hey thanks for that. I kinda think I didnt explain myself here so I have edited the question. Brain is fried lol

    I essentially want the user to be able to hold the actor(when touch is pressed) then drag the actor around the scene to shoot. Like in this example -


    thanks!

    Like Balls? Then click here! We've 100 coming soon

  • jigglybeanjigglybean Member Posts: 1,584
    after hours I have managed to figure it out. I knew by asking, I would find the answer some how lol

    FYI -
    I made 2 rules
    The first one -when touch is pressed then dragged in a constrain attribute behavior and constrain attribute self position x to mouse position x

    then in the second rule have when touch is pressed dragged in a constrain attribute behavior and constrain attribute self position y to mouse position y

    Bingo!
    Now to add the shooting

    Like Balls? Then click here! We've 100 coming soon

Sign In or Register to comment.