Skip to content

Commit 742ea87

Browse files
authored
Merge pull request #633 from starptr/master
Use the Jump sound already present in the Platformer 2D demo
2 parents 85c1805 + 45f5417 commit 742ea87

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

2d/platformer/src/Actors/Player.gd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ onready var platform_detector = $PlatformDetector
1313
onready var animation_player = $AnimationPlayer
1414
onready var shoot_timer = $ShootAnimation
1515
onready var sprite = $Sprite
16+
onready var sound_jump = $Jump
1617
onready var gun = sprite.get_node(@"Gun")
1718

1819

@@ -46,6 +47,10 @@ func _ready():
4647
# - If you split the character into a state machine or more advanced pattern,
4748
# you can easily move individual functions.
4849
func _physics_process(_delta):
50+
# Play jump sound
51+
if Input.is_action_just_pressed("jump" + action_suffix) and is_on_floor():
52+
sound_jump.play()
53+
4954
var direction = get_direction()
5055

5156
var is_jump_interrupted = Input.is_action_just_released("jump" + action_suffix) and _velocity.y < 0.0

0 commit comments

Comments
 (0)