Freezing the actor

CaptainXCaptainX Member Posts: 14
edited November -1 in Working with GS (Mac)
Hello,

I would like to freeze my actor movement when he get hit for 1 sec.
Ex; I got hit and I can't move the character for 1 sec. How can I do this?

thank you

Comments

  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    Something along the lines of:

    Create new actor integer attribute (in your main actor), called 'frozen'
    if actor collides with object, have timer for 1 second that makes frozen active.

    Add rules to your actors movement rules (e.g. move to touch, move right when right key pressed).

    Make it so the movement rules need the 'frozen' attribute to be not active....

    See if you can work with that...if not I'll quickly check and right a proper how to...
  • CaptainXCaptainX Member Posts: 14
    I've add a new attribute called frozen in the main actor but I don't get the other part, have a timer for 1 second that makes frozen active ... I will really appreciate if you can do a How to :)

    thank you
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    Cool...let me just do it myself to check it works then report back....If I can upload a project I'll do that too so you can break it apart and see what I've done...

    I'll make it so the main actor moves left and right with the left and right keys.

    If it hits a wall, stop those buttons working for 1 second.

    cool?
  • CaptainXCaptainX Member Posts: 14
    sounds good, I don't use the keys, I move my character by dragging him on screen , up and down only...
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    ok, I'll do it with touch instead (just had it working with left and right keys so it is possible)
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    Damn it.... just made a tutorial project...but the GameSalad server is down....(Got carried away and made a title screen and everything....I'll upload it when I can).

    In the mean time....here's a link to a zip file with the project file...
    http://stormystudio.com/freeze.zip

    Hope you can work it out from that.

    (I added the integer attribute 'freeze' to the main actor. There is a timer which says if collide with object, change freeze to 1 for 1 second, and another timer after 1 second make freeze = 0.

    Put the constrain actors position inside a rule, so it only works if 'frozen' = 0

    Let me know how it goes...

    (You said your actor only moves up and down, so you can ignore the constrain actors X position to touch x position and just use the Y).
  • CaptainXCaptainX Member Posts: 14
    You are so kind, it work !

    thanks
Sign In or Register to comment.