Distance restrictions

0 favourites
  • 6 posts
  • I got a problem here mates, I'm working with a sprite(lets call it "amigo") whose coordinates are related to the mouse coordinates, and that sprite has to be restricted in a circular area.

    Suposing that there is a sprite ("chain") whose coordinates are the center of the circunference, How Can I make that if "amigo" gets x distance away from "chain", "amigo" gets restricted in that circular area.

    I'm letting here a picture that I hope it helpsMuch thanks people!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you need some help, first change your post title to something that will describe your issue.

  • If you need some help, first change your post title to something that will describe your issue.

    Aww sorry, its my first post and I forgot it :/

  • Someone with more knowledge can correct me, but I believe you will need to have a physics object for each link in your chain, then create a distance joint between all the links. This will make your "amigo" move around inside any given radius, while restricting it going any further. Make "chain" unmovable" and attach "amigo" to the mouse position.

    I don't know if that helps or not as I'm just thinking off the top of my head.

  • I can think of the pin behavior, in "Rope" mode, if you do not need physic interactions, that would work

  • Simple trigonometry with the clamp expression will also help you. See example.

    I also included a pin example.

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