How do I use Sine behavior on an object that is pinned to another object?

0 favourites
  • 4 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • My game mechanic requires all the platforms to be pinned to a huge invisible wall. When I added Sine behavior (bobbing up and down) to one of the platforms, I was hoping it would move relative to where it was pinned, but instead it just doesn't move. If I unpin it, it moves as it should.

    How do I move a platform with Sine while keeping it pinned to something else that doesn't move?

  • I don't think you can with the pin behavior since it stops all other movement from happening. If you remove pin then you could just add an image point to your invisible wall, then every tick set the platform x and y to the image point. Then sin behavior *should* work relative to that position.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's possible in r212 with the new Scene Graph feature.

    Don't pin the platform to the big wall, instead use "Wall add child Platform". It will be dragged with the wall and also move with Sine behavior.

    .

    Another method: Save platform initial position relative to the wall in a pair of instance variables StartX and StartY. Run Sine for value. On every tick update platform position to (Wall.x+Platform.StartX, Wall.y+Platform.StartY+Platform.Sine.value)

  • It's possible in r212 with the new Scene Graph feature.

    Don't pin the platform to the big wall, instead use "Wall add child Platform". It will be dragged with the wall and also move with Sine behavior.

    .

    Works perfectly, thank you!

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