Platforms with Sine/Cosine Movement

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • So I've seen a lot of AlmightyZenTaco's YouTube videos on CF2.5. They're great, especially for a noob like myself, but I'm interested in making a hybrid of two of his tutorials: Moving Platforms and Sine/Cosine Movement. What I'm trying to do for my game is have moving platforms that follow sine/cosine movement. I have succeeded in making them animate properly in left/right, up/down, diagonal, and circular motions; however, I can't get the collisions or movement right with the Platform Movement Object. In AZT's moving platform tutorial, he shows how to achieve proper PMO movement with a "platform indicator" object that's attached to the PMO. My only guess is I need something like this for these new platforms. If so, I just don't know how to do it. If anyone could help me out with this endeavor, I'd greatly appreciate it.

    For reference, here is the behavior of the circular "platform":
    Start of Frame, platform
    -> Set CenterX to X("platform")
    -> Set CenterY to Y("platform")
    Always, platform
    -> Set X position to CenterX("platform") + Cos(timer / Time("platform")) * Amp("platform")
    -> Set Y position to CenterY("platform") + Sin(timer / Time("platform")) * Amp("platform")

    And here is the behavior of a diagonal "platform":
    Start of Frame, platform
    -> Set CenterX to X("platform")
    -> Set CenterY to Y("platform")
    Always, platform
    -> Set X position to CenterX("platform") + Sin(timer / Time("platform")) * Amp("platform")
    -> Set Y position to CenterY("platform") + Sin(timer / Time("platform")) * Amp("platform")

    AZT tutorials:
    Moving Platforms - Please login to see this link.
    Sin & Cos Movements - Please login to see this link.

  • If I am understanding properly I think I was able to accomplish something like this quite a while ago, but not using PMO.

    I can't post gifs so go here to see it in action. Please login to see this link.

    Read the difference and X and Y between the current frame and previous frame and apply that to the player. This may introduce a 1 frame delay causing desync between the player and the platform - if it does then you will need have one invisible platform and one visible platform for each platform in your game. Have the invisible be the one that you directly apply the movement to and have the visible one be the one you can collide with. Apply the difference to both the player AND the visible platform and that should resolve the desync. There may be other workarounds

    Edited 2 times, last by GamesterX23 (December 6, 2022 at 7:28 PM).

  • Hey fellas, thank you for your replies.

    DaveC - That's a very good Kid Icarus clone. Since I'm still new to CF, I've been combing through all the conditions to gain an understanding of what they are and what they do. I also didn't know what qualifiers were before checking it out so that's some useful information I've acquired. I tried a few times to transfer the appropriate actions over to my test application but haven't succeeded yet. For someone of my skill level, this is a lot to absorb. I'll keep trying though.

    GamesterX23 - I think I see what you were talking about in that gif, the swinging action on the chandelier. That game looks great, by the way. I don't actually know how to read the differences nor apply them to the player, sadly. I believe the one frame delay is already present in my current moving platforms (the AZT ones) since the player sprite is 1-2 pixels lower then the platform when it goes up and 1-2 pixels higher when going down. I was ready to accept it as it was, but with what you told me and DaveC's KI mfa I may be able to fix it.

    I'm going to keep at it. I'm sure I can get it working properly eventually. Should only take a few "Aha!" moments. Thanks again!

    Edited once, last by dujata (December 8, 2022 at 12:19 AM).

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!