setting actor as not movable and move it while the run time

alialialiali Member Posts: 6
edited August 2012 in Working with GS (Mac)
I sat an actor non movable , I want to move it in run time .
I tried to use Constrain Attribute (set X , Y) but it did not give reality in moving, not like when you set the actor movable you can see reality in dropping from up to down and collision .

any idea please ?

Best Answers

  • gyroscopegyroscope I am here.Posts: 6,598
    edited August 2012 Accepted Answer
    I was in such a rush to get out of the door today (just come home at 11.30pm) I forgot to mention that the rule applies to your first actor you want dropping automatically, so

    Rule When CountDrop = 1
    Change Attribute self.Motion.Linear Velocity.Y to 100

    THen the bit I forgot to add:

    in actor 2:
    Rule When CountDrop = 2
    Change Attribute self.Motion.Linear Velocity.Y to 100

    in actor 3
    Rule When CountDrop = 3
    Change Attribute self.Motion.Linear Velocity.Y to 100

    etc.

    But going back to why its not working with the first one, you've probably forgot to make the attribute CountDrop value as 1 in the attributes list, or forgot to check Moveable. If you find it'll work now, (which you will) you'll realise there was no reason to have rejected my answers.

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

  • gyroscopegyroscope I am here.Posts: 6,598
    edited August 2012 Accepted Answer

    Hi @aliali

    Firstly, apology to you, all of the velocity attributes should be set to minus for the actors to fall rather than travel up; you never mentioned a problem there so must have realised that....

    If you've put a collide behaviour in each of your falling actors, then it will collide, no problem, even if you're using velocity – but will bounce up again, even with bounciness set to 0. You could make density and friction a high number to stop that, but perhaps a better way would be:

    Forget the collide behaviour, and change the rules to:

    in actor 1:
    Rule When CountDrop = 1
    Constrain Actor1.Position.Y
    --the following rule nested in the above rule
    When Actor1.Position.Y < 20 ---- or whenever you want the actor to stop
    Change Attribute self.Motion.Linear Velocity.Y to -100
    otherwise
    Change Attribute self.Motion.Linear Velocity.Y to 0

    in actor 2:
    Rule When CountDrop = 2
    Constrain Actor1.Position.Y
    --the following rule nested in the above rule
    When Actor1.Position.Y < 20 ---- or whenever you want the actor to stop
    Change Attribute self.Motion.Linear Velocity.Y to -100
    otherwise
    Change Attribute self.Motion.Linear Velocity.Y to 0

    etc.

    Hope that sorts it for you.

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

  • gyroscopegyroscope I am here.Posts: 6,598
    edited August 2012 Accepted Answer

    Sorry again, it's because I'm thinking it through - i.e off the top of my head – without checking in GSC as a test game file.

    Make a real attribute let's call it MinValue

    in actor 1:
    Rule When CountDrop = 1
    Constrain MinValue to Actor1.Position.Y
    --the following rule nested in the above rule
    When MinValue < 20 ---- or whenever you want the actor to stop
    Change Attribute self.Motion.Linear Velocity.Y to -100
    otherwise
    Change Attribute self.Motion.Linear Velocity.Y to 0

    etc for other actors, changing CountDrop accordingly.

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

Answers

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    @aliali

    Hi, setting an actor to non-moveable is just that, I'm afraid, and can't be changed to move by any means at runtime. (Although you can get the actor to react to collision).

    One solution is to check Moveable and move your actor between two points using velocity, for instance.

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

  • alialialiali Member Posts: 6
    edited August 2012
    @gyroscope

    I will explain what I want to do .

    the game contain 10 actors , when the game start , the first actor will be dropped for you , if you finished from the first actor , it should destroy him and drop the second actor and so on .

    how can I deal with that please
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited August 2012

    OK, try this method (like a lot of things in GSC there's more than one way to do it):

    Make an integer attribute, let's call it CountDrop, and set its value to 1.

    Name your actors that drop to something like drop1, drop2, drop3, etc.

    In each of your dropping actors, put:

    ---in drop1
    Rule When CountDrop = 1
    Change Attribute self.Motion.Linear Velocity.Y to 100 --- or whatever speed is required
    ---- you could also use Accelerate set to 270º if you preferred, where it'll drop faster and faster up to a set speed
    --- you could put a Destroy behaviour once the actor is off-screen but the actor will be destroyed automatically anyway once past a certain distance from the screen.

    I'm not sure what gameplay you want whereby the dropping actor is destroyed; I'm going to assume it's by touching the dropping actor. So continue with another Rule

    When touch is pressed and self.Motion.Linear Velocity.Y > 0
    Change Attribute CountDrop to CountDrop+1
    Destroy

    That should work out for you; I'm away til tomorrow (off now) but if you've any more queries about this I'm sure another member will help you out.

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

  • alialialiali Member Posts: 6
    @gyroscope thank you , I did as you said exactly but did not work

    code :
    Rule When CountDrop = 1
    Change Attribute self.Motion.Linear Velocity.Y to 100
    Display Text

    it displaying the text very well , but not moving at all .
  • alialialiali Member Posts: 6
    @gyroscope thank you , but I still have problem .

    to do as you saying I have to make the gravity x = 0 y = 0
    but when the actor collide to floor , it keep moving all time , what I mean is how to solve collide problem.
  • alialialiali Member Posts: 6
    @gyroscope

    Constrain Attribute : Constrain Actor1.Position.Y To ?
Sign In or Register to comment.