Make an actor rotate yet not be affected by gravity?

homelesswombathomelesswombat Member Posts: 73
edited November -1 in Working with GS (Mac)
I unchecked the "movable" attribute which makes it unaffected by gravity, but apparently not being movable means it also has fixed rotation.

Anyone know a way to do this? I know it's possible to create an invisible actor that "holds up" the rotating one, but that is a level building nightmare. That solution also doesn't work if the rotating actor is bigger than the scene.

Comments

  • scitunesscitunes Member, Sous Chef Posts: 4,047
    I would suggest not using gravity at all. Just put an acceleration behavior in any falling objects and set the direction to 270 relative to scene. Then other objects without the behavior will not fall and you can do things like rotate them. You may want to create an integer game attribute called gravity (or something) and set it to what you want gravity to be. Then use this in the speed setting in all of your accelerate behaviors in all of your falling actors. So that if you decide to increase gravity you don't have to go in to every falling actor and change it. You can just change the game attribute value.
  • homelesswombathomelesswombat Member Posts: 73
    Cool thanks for the solution sci, I've managed to make a nice background with it. But I also want to make rotating platforms for a 2D platform jumper. Now whenever the player or anything collides with them, they just sink into the bottom of the scene, along with my player :(
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    I think you need to play around with the density settings. Set the platforms' densities to something really high.
  • homelesswombathomelesswombat Member Posts: 73
    Alright I figured it out.

    Actor: Platform
    1) Create two new variables self.homeX and self.homeY. Use Change Variable so that the latter variables are set to the current x,y position of the actor. This will make the actor "know" where it spawned.
    2) Set the Density really high, like 1000.
    3) Create a Timer
    Every .1 seconds
    Move to homeX, homeY
    Speed: 30

    What's fun is I found that if I use Accelerate Toward homeX, homeY, set the timer to every 1-2 seconds and lower the density, it makes really nice "fall away" platforms that return to their original position.

    These kinds of platforms can also spin in place and do all sorts of things you can't with the "Moveable" attribute unchecked.
  • rebumprebump Member Posts: 1,058
    Cool to know about the fall away effect.

    (mainly commenting to add tags)
Sign In or Register to comment.