How do I detect and move at angle?

0 favourites
  • 4 posts
From the Asset Store
This is a code so you can see the same skin on all screens (peers). Each peer gets a skin, in addition to 4 directions t
  • I am trying to figure out how to swipe behind a sprite and send it in the opposite direction of that angle (like soccer stars)

    So, if I swipe, "pull back" at the bottom right of a sprite, then let go, that would move the sprite up and to the left.

    At this point I am not sure where to begin? Is there an example or tutorial available? Is it easier than that? (Do I add Physics behavior?)

    Thanks for any advice or links to tutorials!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You need Touch.SpeedAt() and Touch.AngleAt() expressions.

    Try something like this:

    On any touch end:
     Ball Bullet set speed to min(Touch.SpeedAt(0), 500)
     Ball Bullet set angle of motion to (Touch.AngleAt(0)+180)
    

    Instead of Bullet behavior you can use Physics if you like - apply physics impulse at angle.

  • Thanks for the reply, still trying to make this work.

    I've added physics behavior and trying to add impulse at angle.

    -What does 0 represent Touch.AngleAt(0)+180?

    -I want the speed to increase the further back from the sprite end touch

    Right now when I preview the sprite just drops off the bottom of the screen, is there a gravity setting I need to change? My game is top down view so I don't need gravity.

    - is there a tutorial for what would be similar to moving a hockey puck, I prefer not to ask so many questions, I just have no idea where to start. Thanks.

  • Found game physics tutorial here, nevermind on the gravity

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