GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How to make a movable actor immovable when hit by enemies

blackmoroiblackmoroi Posts: 28Member
edited September 2014 in Working with GS (PC)
Pls help me..I am trying a top down maze game in which player has to move some blocks to advance the level.but the blocks should not move if hit by enemies.plss help me what to do..I tried many methods like varying the weight and drag but still no use....Pls give a suggestion..

Answers

  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,913Member
    edited September 2014

    Contrain the positions of the blocks unless they come in contact with the player.

    Make 2 self attributes "real type"

    Self-X
    Self-Y

    Constrain attribute. Self-X to self.position.X

    Constrain attribute. Self-Y to self.position.Y

    Rule

    When actor receives event "overlaps and collides with player"

    No code in main part of rule

    Otherwise

    Constrain attribute self.position.X to Self-X

    Constrain attribute self.position.Y to Self-You

    Make sure the code is ordered top to bottom as written so the position gets written to the self attributes before the otherwise of the rule kicks in.

  • blackmoroiblackmoroi Posts: 28Member

    thanks a lot..I understood the ideas.Let me try it on my game.again thanku very much... <3 :)

Sign In or Register to comment.