How do I move sprite left and right by touch?

0 favourites
  • 3 posts
From the Asset Store
A complete set of graphical user interface (GUI) to build 2D video games. With wood, nature, & jungle theme
  • hi,

    I have a problem where i want a sprite to move left and right by touch.

    The idea is this, if the sprite moves to the left, then by touching the screen (doesn't matter where on the screen) the sprite should be moving in the opposite direction (180 degrees), and when the screen get touched again it should change direction to the left again (and on and on).

    I tried this with the bullet behavior and the 8 movement behavior but it doesn't really work out so far.

    Manny

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • So the location of the touch doesn't matter, it is touch anywhere on screen? You can do this by toggling a boolean.

    On any touch, toggle sprite.boolean (between true and false)

    If boolean = true, every tick simulate control move left

    boolean = false, every tick sim control move right

    Something like that.

  • Yes, the touch has to be on the screen.

    Okay, thanks Plinkie! That sounds like a good solution, I will give it a try.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)