gravity help

jhaasjhaas Member Posts: 233
edited November -1 in Working with GS (Mac)
I'm working with gravity for the first time and need a little help. :)

When I set gravity above zero all movable actors slide off the screen as soon as I hit the preview. I need some actors to be able to move but how to I keep them from falling off the screen?

Setting movable to no keeps them in place, but it also prevents them from being able to move. I looked at the example games that use gravity and I'm missing something. ???

Comments

  • jhaasjhaas Member Posts: 233
    Never mind, I found the constrain attribute code that will counter act gravity.

    Sorry for the post - go back to your lives citizens. :)
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    Just note that when you use constrain to keep the actor in the Y position to make it seem like it is ignoring gravity, it is just redrawing your image every frame in that position. If you show the Y linear velocity, it is still increasing. So you may need to give it an acceleration opposite of gravity to fix that too.
Sign In or Register to comment.