How to create a rotating disc floor?

0 favourites
  • 5 posts
From the Asset Store
Simple resize and rotate events for any sprite, quick and easy event sheet that you can use for your own projects.
  • I am trying to create a rotating disc floor (top-down) so that when the player stands on it, they move with the rotation of the disc floor. I'm not sure how to make the player move with it properly. Everything else is done, just need to have it affect the player.

  • u got to give the player a main position on a circle first, if its top down u can use the gravity "spin" around a planet tutorial that is like a decade and little over old...

    but basically u get a center point, and then for movement u just use X = circleCenter.X+cos(loopindex*N)*angle*dt

    Y=circleCenter.Y+sin(loopindex*N)*angle*dt

    i dont recall the formula exactly but was something like that.

    and to have the character move with it you have to disable the rest of position controls of the character, maybe a special localnumber or boolean on character, that swaps states from "walking" to "moving in circle" doesnt really matter the naming.

    as per "walking" u would enable ur regular controls

    if is not "walking" then it means he is in the circle states and then u disable the regular controls and enable the positioning based where he is at in the circle.

    or u can simply use Pin behavior angle and XY.

    but remember disable the other control methods before u pin.

    and will only work if ur circle is actually changing angles aka spinning if its a "spining animation" ur object doesnt actually spin so ... ur character will stay in place not doing nothing.

    see if this helps

    drive.google.com/file/d/1cdSxOkltTVxp6ONy7HkNeR0H5qLULayN/view

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here is something similar, but it may not work in your game:

    howtoconstructdemos.com/relative-movement-on-another-moving-object-capx

    You can use the hierarchy feature - add the player to the floor as a child. Check "Transform x", "y" and "angle". I just tested - the character rotates with the floor, and you can control it. But you might need to compensate for floor rotation - increase the velocity when moving in the same direction as the floor for example.

  • If you know the speed the disk is rotating then you can rotate the sprite by the disks center by that amount.

    Sprite: overlaps disk

    — sprite: set position to (self.x-disk.x)*cos(disk.rotateSpeed*dt)-(self.y-disk.y)*sin(disk.rotateSpeed*dt)+disk.x, (self.x-disk.x)*sin(disk.rotateSpeed*dt)+(self.y-disk.y)*cos(disk.rotateSpeed*dt)+disk.y

  • Thank you for the help! Finally got it working. Didn't expect a minor world obstacle to take all day to debug but hey, it works now.

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