Why wont self.physics.movable let me change mid game?

QuestionManQuestionMan Member Posts: 81
edited July 2012 in Working with GS (PC)
K so I've done some testing, I know I must be missing something really simple here. I have an object that if I have the 'movable' field checked, when I preview it, the object slowly falls to the floor because of gravity. I also have a button, when I click it, it propels that object at an upward angle.

The problem is the gravity isn't supposed to be triggered (at least on that object) until after I click the button.

To solve this, I'm assuming the 'movable' field has to be unchecked, and when the button is clicked, have self.physics.movable changed to 'true'

I did this with 'change attribute', and it wont move at all now. It doesnt seem to recognize the change attribute for self.physics.movable.

Any ideas?

Comments

  • SparkyidrSparkyidr Member Posts: 2,033
    Yeah. That's one of the attributes you can't change at runtime unfortunately.


    You could constrain the velocity to 0 until gravity is triggered maybe?
  • QuestionManQuestionMan Member Posts: 81
    Ok I'll try that. A quick question though, for booleans, when you change attributes, do you type 'true' and 'false' in lowercase letters? Its not an auto fill so I have no idea if its even trying to change it to the appropriate setting
  • QuestionManQuestionMan Member Posts: 81
    Oh and btw your constrain idea worked, thanks man! Too bad you cant change that attribute during runtime though
  • SparkyidrSparkyidr Member Posts: 2,033
    yeah.. just type true or false in lowercase and it will work.
  • troynalltroynall Member Posts: 15
    i have a platform that I can move to the right via a "move right" button.
    as well as move left, rotate clockwise and rotate counter clockwise.

    they all obey my button pressing.

    i set all of the above(buttons and platform) self.physics.moveable to false(uncheck).

    i am dropping a ball onto platform. and make it collide/bounce with the platform.

    however, now i cant control my platform. it just sits there.

    can I momentairly toggle self.physics.moveable to true, do my button movement control the set the self.physics.moveable to false?

  • SocksSocks London, UK.Member Posts: 12,822
    edited December 2013
    @troynall
    can I momentairly toggle self.physics.moveable to true, do my button movement control the set the self.physics.moveable to false?


    Make two identical platforms, one with self.physics.moveable set to false and one with self.physics.moveable to true.

    When you want to swap between them, destroy one platform at the same time as spawning the other.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    For Boolean switch you can also use 1 and 0
Sign In or Register to comment.