GameSalad

Howdy, Stranger!

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

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 Posts: 37Member

    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 Posts: 24Member, PRO

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

Sign In or Register to comment.