How do i Move my actor to a specific Position and back again?

Bob132546Bob132546 Member Posts: 18

I want to move my actor to a specific position(coordinates) when i press any where on the screen. I also want to move it back to its original position when i press anywhere on screen anyone help?

This is what i want it to do, move my character from coordinates X 139 and Y 131 to X 179 Y 131 whenever i press the screen

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2014

    Make an integer attribute within the actor, let's call it A - and place your actor on the screen at X-139, Y-131.

    Rule: When mouse button is down:

    • Change Attribute: self.A to 1-self.A

    • Move To: X = 139+( self.toggle *40) and Y = 131.

  • Bob132546Bob132546 Member Posts: 18

    ok so i have done what you've said but it still doesn't move, would it be possible to send a screenshot of what you have done to see where i went wrong?

  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2014

    @Bob132546 said:
    ok so i have done what you've said but it still doesn't move, would it be possible to send a screenshot of what you have done to see where i went wrong?

    What I have done ? What I did was make the post above, I could take a screenshot of that if you want ! ;)

    Why don't you take a screenshot of your rules and post it here ?

  • Bob132546Bob132546 Member Posts: 18

    this is what i have done. Im kinda new to game salad so i dont really know what im doing
    http://gyazo.com/22cc62355882919ef04f6ca25c6628f8

  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2014

    @Bob132546 said:
    this is what i have done. Im kinda new to game salad so i dont really know what im doing
    http://gyazo.com/22cc62355882919ef04f6ca25c6628f8

    Whoops, my mistake entirely :blush: I type 'toggle' in instead of 'A' ('A' is toggling between two values) . . . . so it should have read . . .

    . . . . . . . . . .

    Make an integer attribute within the actor.

    Let's call this attribute A</font color>.

    Place your actor on the screen at X-139, Y-131.

    . . . . . . . . . .

    Rule: When mouse button is down:

    • Change Attribute: self.A</font color> to 1-self.A</font color>

    • Move To: X = 139+(self.A</font color>*40) and Y = 131.

    . . . . . . . . . .

    (don't forget to select attributes from the pull down menu, rather than typing them in by hand)

  • Bob132546Bob132546 Member Posts: 18

    ok i must have done something wrong because i changed it to 139+(A*40) but when i click preview and click on the screen my player just does not move?

    sorry for the hassle

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

    @Bob132546 said:
    ok i must have done something wrong because i changed it to 139+(A*40) but when i click preview and click on the screen my player just does not move?

    Did you select A from the pull down menu, or did you just type it in by hand ?

  • Bob132546Bob132546 Member Posts: 18

    Typed it in by hand, but when i go on the pull down menu and go on Player - A it prints out self.A

  • Bob132546Bob132546 Member Posts: 18

    Oh my bad, ive done it Thanks for the help man really helpfull

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

    @Bob132546 said:
    . . . . when i go on the pull down menu and go on Player - A it prints out self.A

    Sorry, my instructions were a bit rubbish today ! lol, need coffee . . . . .

Sign In or Register to comment.