How do I change the position where an object is pinned?

0 favourites
  • 3 posts
From the Asset Store
Simplistic hyper-casual game with nature elements. Tap to switch between the 4 elements and reach a better score.
  • I am currently creating a game based on the classic arcade game "Frogger". When the frog (with an 8 direction behaviour) jumps on a log (with a bullet behaviour) I would like it to be pinned to the position of the log. I currently have a pin behaviour on the frog and have the following events.

    Condition: Frog is overlapping log Action: Frog pin to log (position only)

    Condition: On any key pressed Action: Frog unpin

    The frog does pin to the log, however no matter where the frog jumps onto the log, the frog pins right on the edge of the log. Is there any way I can change where the frog will pin to the log? I have tried changing the origins and collision polygons of both the frog and the log but have had no success.

  • Well, your condition says "Frog is overlapping log", so yes, from the moment the two objects will be in touch, they'll be pinned.

    And so it means from the moment the frog touches the edge of the log.

    You should add more conditions to the "Overlapping" event to check out the current Y position of the frog in regards to the log :

    Frog is overlaping Log

    Frog.Y > Log.Y - 24

    Frog.Y < Log.Y + 24

    Those two added conditions would check a range and only pin the Frog when it is about 48 pixels from the Log.Y position.

    Adjust this value accordingly to the height of your log.

    Also you can add a condition Set Frog.Y to Log.Y in order to have the frog in the middle of the log (assuming your origin point is in the middle) before the pin action.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Kyatric Thank you for your help

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