Howdy, Stranger!


Changing image depending on position of touch.

Hey guys, was just wondering if anyone knew of a method that could help me when, lets say for example a helicopter, i tapped on the upper left of the screen where i want it to go and it flew towards the left to where i touched, and if i touched to the right of it, it would change the image/animation in the other direction, instead of just flying backwards towards where i touched on the right. so that it always changed to the right image set depending on which direction i touched. if anyone has any suggestions it would help out alot. thanks in advance.


  • ElfizmElfizm Posts: 489Member
    Constrain x and y position of your helicopter to game.attributes.

    Have a rule if touch1 position is less then game.helicopters Y
    Change to facing down image

    If touch is greater then y
    Change to facing up

    If touch position is less then game.helicopter X
    Change to facing right

    If touch is more then X
    Change to facing left image

    Hope that helps and all the best
  • ElfizmElfizm Posts: 489Member
    Actually you can forget about the constrain and just use self.position for the helicopter.
  • TaidakenTaidaken Posts: 271Member
    Hey thanks, that helped heaps :)
This discussion has been closed.