Collide + Screen shake

Hello,
I'm creating a platform jumping game. I'd like to make an effect that when the player hits an enemy, both of them freeze, at the same time screen shakes. after that, it changes to the game over scene.
at the moment, it goes to the game over scene directly after the player collides with an enemy.
Can anyone help with it?
Thanks!

Comments

  • awesome_wellsawesome_wells Member, PRO Posts: 38

    Hi @honeymimi56,

    Firstly I would make a global boolean attribute (e.g. 'game_over')

    Now, set a rule in the player:

    [When] - Actor receives event - overlaps or collides - [with] - actor of type - "enemy"
    
    Change attribute - game.game_over - [To:] - true
    
    Timer - After - 2 - [seconds]
    
           Change Scene - [Go to Scene:] - "Game Over"
    


    Then, in each actor you want to freeze, include the rule:

    [When] - Attribute - game.game_over - [is] - true
    
    Change attribute - self.Physics.Motion.Moveable - [To:] - false
    


    To make the screen shake, I would create an new actor (e.g. 'Screen_Shaker', with visibility set to false) and place it in the Scene.

    Now, double click on the 'Screen_Shaker' actor in the scene window and click the lock to enable editing of scene behaviours.

    Create a rule in this unlocked 'Screen_Shaker' actor:

    When - Attribute - game.game_over - [is] - true
    
    Timer - Every - 0.01 - [seconds]
    
          Change attribute - scene.Camera.Rotation - [To:] - random(-10,10)
    


    I hope that helps!

  • honeymimi56honeymimi56 Member, PRO Posts: 24

    Hi Awesome_well, thank you so much! It's really helpful :blush:

Sign In or Register to comment.