tags: physics title: Knockback brief: This example shows how to create a knockback effect when hit. author: Defold Foundation scripts: enemy.script
This example shows how to create a knockback effect when hit. The setup consists of three game objects; one for the player, one for the enemy and one for the bullet that is spawned using a factory (see example on how to spawn bullets).
player : The red ship at the bottom. Contains:
bullet : The bullet fired by the player. Contains:
KINEMATIC
. It has a sphere Shape matching image.enemy : The black ship at the top. Contains:
KINEMATIC
. It has a sphere Shape matching image.