How do I change direction using tap / touch coordinate?

0 favourites
  • 2 posts
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • Hello, I just found about Construct few days ago, and I'm trying to make a game that look like this "https://play.tresensa.com/preview?placement=2oe9&line=859", I got a problem in changing the snake direction to the coordinate of the touch input. So far I'm trying to give the snake head a bullet behavior and try to change it's direction by changing the snake head's vector X upon a touch input. But I don't know how to make it only turn left or right depending on the angle of where I touch the screen compared to the snake head.

    For example, I'd refer to my drawing here i.imgur.com/G5VlKSY.png

    Any kind of help will be much appreciated, thanks in advance.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can put two invisible sprites - one on the left and one on the right side of the screen.

    On touched LeftSprite 
    -> Snake set Angle of Motion to (Snake.Bullet.AngleOfMotion-90)
    
    On touched RightSprite 
    -> Snake set Angle of Motion to (Snake.Bullet.AngleOfMotion+90)
    
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)