Make fluid touch controls for Rotate Controls?

  • I'm looking at porting over a tutorial I've done to my android and just wonder is there anyway I can get fluid rotation when touching the screen it only seems to face a certain when the screen is 1st touched. I'm wanting it to face the direction of the finger constantly until the finger is raised off the screen. how can this be done?

    Also how can I also do it so if I press a 'fire' button the character doesn't face that direction?

    Thanks Matt

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 1st question, If I understand you correctly:

    Mouse:

    System.EveryTick

    Mouse.MouseButtonIsDown(Left)

         -> Sprite.SetAngleTowardsPosition(Mouse.x, Mouse.y)

    Touch:

    System.EveryTick

    Touch.IsInTouch

         -> Sprite.SetAngleTowardsPosition(Touch.x, Touch.y)

  • Thanks this is just what I wanted!!

    just need to find out how to do the second one now.

    Thanks Again

  • I dont understand what you want for the second one, Explain it more and i'll probably be able to help.

  • Also you should get rid of the mouse plugin and set the touch property "Use mouse input" to yes. You can then avoid duplicating code if there's nothing specific to the mouse required.

    For the second question indeed, I'm not sure exactly what you're trying to achieve.

  • Wow I never knew the touch object had a "Use mouse input" property <img src="smileys/smiley3.gif" border="0" align="middle" />, you learn something new everyday <img src="smileys/smiley1.gif" border="0" align="middle" />!

    Does that only work in preview or when exported aswell?

  • Hopefully when exported too.

    I don't have touch device, so I can't test it, but there's no reason why it shouldn't work.

    This feature has been added some releases ago.

  • Ahh sorry,

    What I mean is if I have a object on the screen to use as a "fire" button say in the bottom left of the screen.

    The player will always face that direction of the "fire" after touching "fire" button, therefore after every time I press the button I have to reset the direction I want the player to face

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