Creating a collide action which freezes all other actors on scene for 10 seconds.

I am relatively new at this and am working on a platform style game in which I have a "Special item" which the main character can collect for a "boost" so to speak, Does anyone know how to make a collision rule that would make it so when the main character collides with this actor the enemy freezes movement for 10 seconds. Please do help as much as possible. Much appreciated.

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Boolean attributes are used for exactly this purpose because they can be one of two values: true or false (aka on or off). Create a boolean game attribute called game.SpecialEnabled. Set it to false (unchecked).

    In your main character actor, add a rule that says:

    When actor collides with [special item actor]
         Change attribute game.SpecialEnabled to true
         Timer after 10 seconds [run to completion MUST be checked]
              Change attribute game.SpecialEnabled to false

    In your enemy actor, add a rule that says:

    When attribute game.SpecialEnabled is true
         [no behaviors or a behavior to stop movement, such as Change Velocity with speed set to 0]
    Otherwise [put this next part in the Otherwise section for the rule]
         [your existing movement rules]

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • BryceVanceBryceVance Member Posts: 13
    Thanks tatiang that worked perfectly. however just one question for the enemy actor rule. my enemy actors not only move they also currently shoot a projectile at the main character if he is within 200 from the enemy. what would I have to add to there rule to stop the shooting for that 10 second period as well?
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    If you want the enemy to do none of its normal rules when that attribute is true then put all of its rules and behaviors in the otherwise section. Or better yet change the rule to When attribute game.SpecialEnabled is false and then put all of the rules and behaviors in that rule.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • BryceVanceBryceVance Member Posts: 13
    Thanks that was quite helpful.
Sign In or Register to comment.