Moveable, then not...

ells1231ells1231 Member Posts: 16
edited November -1 in Working with GS (Mac)
Is there a way to change whether an object is moveable or not during play?
e.g. The user moves a platform into place(and so has to be moveable) and then when you hit play, it is no longer moveable so other actors can collide with it and it stays still.

Thanks in advance,

Comments

  • 2D-Sprite-Box2D-Sprite-Box Member Posts: 72
    Boolean attribute moveable, add rule to play button, when mouse inside and down (or touch pressed) change moveable to false, in the platform, rule when attribute moveable is false change self physics movable false, otherwise self physics movable true

    How does that work
  • BarkBarkCoBarkBarkCo Member Posts: 1,400
    I believe `Moveable` cannot be changed at runtime.
  • ells1231ells1231 Member Posts: 16
    2D-Sprite-Box said:
    Boolean attribute moveable, add rule to play button, when mouse inside and down (or touch pressed) change moveable to false, in the platform, rule when attribute moveable is false change self physics movable false, otherwise self physics movable true

    How does that work

    Thank you so much!!! Worked a treat!!
  • 2D-Sprite-Box2D-Sprite-Box Member Posts: 72
    Does what you need?
  • 2D-Sprite-Box2D-Sprite-Box Member Posts: 72
    barkbark00 said:
    I believe `Moveable` cannot be changed at runtime.

    I thought the same thing, if that doesn't work, I'd go with constrain the position when movable is false
  • ells1231ells1231 Member Posts: 16
    I thought it worked, but it dosent :( oh well...

    Thanks for the help anyway.
  • ells1231ells1231 Member Posts: 16
    My games crashed now :( time for a restart. I don't think it liked me changing moveable to true / false.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    You cannot change any of the Physics properties of an Actor at runtime...
  • ells1231ells1231 Member Posts: 16
    oh... thats annoying, Im sure I will find a way around it.
  • ells1231ells1231 Member Posts: 16
    Well I am off to bed. thanks for the help everyone.
  • 2D-Sprite-Box2D-Sprite-Box Member Posts: 72
    Go with constraining the position of the platform when movable is false
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    There's a workaround I've thought of; bit clumsy maybe, but it should work; :

    Boolean attribute set to false all the time the bridge is being moved into place; when it needs to be immovable, set the attribute to true; when true, spawn an 8 x 8 pixel actor twice, set to immovable, either end of the bridge. Maybe work out? Don't know, just a thought...

    :-)

    edit: no, that wouldn't work on second thoughts; it'd need collision fro the bridge not to be "got at"...ah well, I tried.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hang on, when the boolean is true, i.e the bridge is in place, destroy it and replace it with an exact dupicate image - different actor - spawned in the same place, which is not moveable. That should do it.

    :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Sign In or Register to comment.