Skip to content

Commit

Permalink
Added the bouncy_water.py example.
Browse files Browse the repository at this point in the history
  • Loading branch information
vinci6k committed Mar 16, 2021
1 parent 8f713d3 commit 9ffbd5f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions examples/bouncy_water/bouncy_water.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# ../bouncy_water/bouncy_water.py

# Enki
from enki.listeners import OnPlayerEnterWater


@OnPlayerEnterWater
def on_player_enter_water(player):
"""Called when the player starts touching water."""
# Get the direction the player is moving in.
direction = player.velocity.normalized()
# Exaggerate the Z axis - this will make the player go up.
direction.z = 0.9
# Push the player away from the water surface.
player.teleport(velocity=direction * 450)

0 comments on commit 9ffbd5f

Please sign in to comment.