Actor move up every time screen is pressed

justinodunnjustinodunn Member, PRO Posts: 226

Hello, how do I make it to when the user touches the touch screen actor, it will cause the actor to move to a specific position, but when they press again, it'll move to another specific location? so there will be a list of specific locations that the actor will move to in order, whenever the screen is touched. Thanks :)

Comments

  • justinodunnjustinodunn Member, PRO Posts: 226

    ?

  • cbtcbt Member Posts: 644

    You should create a variable that tracks the touch count. So every time you touch it increases by 1.

    And in the actor;

    --If game.touchCount == 1
    ---Interpolate self.x, self.y to 222, 333 (or the positions you want)

    --If game.touchCount == 2
    ---Interpolate self.x, self.y to 444, 555

    etc.
    etc.

  • justinodunnjustinodunn Member, PRO Posts: 226

    @cbt said:
    You should create a variable that tracks the touch count. So every time you touch it increases by 1.

    And in the actor;

    --If game.touchCount == 1
    ---Interpolate self.x, self.y to 222, 333 (or the positions you want)

    --If game.touchCount == 2
    ---Interpolate self.x, self.y to 444, 555

    etc.
    etc.

    Thanks, but how can I track the touch count?

  • justinodunnjustinodunn Member, PRO Posts: 226

    heres what i have so far.. the first touch works but second touch already doesn't work.

    can you take a look at it? thanks

  • justinodunnjustinodunn Member, PRO Posts: 226

    doesn't touch count recognize how many fingers are on the screen?

  • cbtcbt Member Posts: 644

    I can't do downloads right now so I can't check the zip.
    You want to setup a rule like;
    if touch is down: game.touchCount = game.touchCount + 1

Sign In or Register to comment.