Posted November 10, 2024 by spindlebink
Moving platforms are a must in a majority of sidescrollers. Yollicosmic currently supports standard axis-locked platforms with configurable movement speeds and wait times at each extremity. I’ve also structured the implementation in a way that should allow platforms to proceed along arbitrary paths as well as axes, but I’m holding off on implementing that unless I feel something’s missing.
You can configure platforms’ sizes and speeds from Tiled. Speed settings aren’t specified in pixels but in multiples of a global period. This makes it a lot easier to reason about where platforms will be at a particular point relative to each other (which for level design is more important than knowing precisely how fast a platform is moving) and also ensures that platforms stay exactly in sync with each other, since we calculate all platform positions relative to the same global time counter.
If a platform has a travel period of 1, it will take 1 cycle of the global moving platform period for the platform to move between its extremities. You can also set a wait time for the platform at each extremity in the same way. The global period setting can be adjusted to speed up or slow down every platform across the game.