Help - Actor moves to mouse click, but didn't stop

AlkagamesAlkagames Member Posts: 12
edited November -1 in Working with GS (Mac)
Hey guys,

I tried to make the actor moves to where is touched. Here is what I did:

- Created 2 actors: Background and Mover.
- 1 global Boolean (move).
- in Background actor: the .move attribute is true when Background is clicked, otherwise is false.
- in Mover actor: a rule when .move attribute is true then move to device.touch1.x and device.touch1.y

It turns out working fine, but the problem is that sometimes that actor doesn't stop. It moves to my clicked point and pass it and out of screen.

Obviously, i did something wrong, but would someone please point out the mistake for me?

Thanks,

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    i would do this;

    make 2 more real attributes movex and movey

    in the background actor when touch is pressed change move to true change movex to decive mouse position x and change movey to mouse position y
    otherwise change move to false

    have a rule in the mover when move is true
    interpolate self position x to movex
    interpolate self positiony to movey
  • AlkagamesAlkagames Member Posts: 12
    perfect... it works... thanks John
  • AlkagamesAlkagames Member Posts: 12
    Guys, I have another problem...

    [IMG]http://i8.photobucket.com/albums/a9/AznGurl4LifeNY/ScreenShot003.png[/IMG]

    The red is mover, white is killer and yellow is where i clicked.

    I made the red box to explode when it hit white.

    When i click the yellow, the red explode when it hit white, but still continue to go to the yellow spot.

    How do i make the red explode and stop right at the place where it hit white?

    I know it's a little bit confused, but hopefully to receive some helps.

    Thanks,
Sign In or Register to comment.