donic the hedgeduck
Awesome! I did something similar a while ago but I never ended up packaging it up.
It’s not letting me view the code.
How did you make the wheel of platforms turn so smoothly?
Did you use sin cos tan?
Yep! The formula looks something like this:
x = cx + Math.cos(game.runtime() / 1000) * radius y = cy + Math.sin(game.runtime() / 1000) * radius
- cx, cy is the center of the circle
- radius is distance from the center
- 1000 is just to convert the runtime into seconds. Make that number bigger to rotate slower, and smaller to rotate faster
In blocks, you can find the runtime in the
game toolbox. It’s the one that says
time since start (ms).
This really helps.
So do this on a game update every ___ ms?
Yep, but if you want it to be smooth then you should probably just use an
on game update (no interval)
How did you make many platforms? How did you make a sprite stick to them?
Ah, that’s tougher. I made my own custom physics engine for that demo. This is not something that you can do in blocks.
Basically, every platform is a “mini tilemap” with its own collisions defined. I also store a list of “riders”, which are sprites that have landed on the platform. When I move the platforms, I also move all of the riders for that platform. A sprite stops being a rider when thy no longer collide with it anymore.
Okay, that seems a bit to difficult for me.