added more sound

This commit is contained in:
Jonas Braus
2024-07-29 19:18:27 +02:00
parent b339ef3c29
commit ea21b49716
6 changed files with 174 additions and 10 deletions
+2 -1
View File
@@ -1,10 +1,11 @@
extends RigidBody2D
@onready var animated_sprite_2d = $AnimatedSprite2D
@onready var animation_player = $AnimationPlayer
func _ready():
animated_sprite_2d.play("default")
func _on_activate_body_entered(body):
if body.is_big:
queue_free()
animation_player.play("destroy")
+10 -4
View File
@@ -7,6 +7,8 @@ extends CharacterBody2D
@onready var coin_amt = $CanvasLayer/Control/CoinAmt
@onready var collision_shape_2d = $CollisionShape2D
@onready var pipedetector_ground = $pipedetector_ground
@onready var pipe_sound = $PipeSound
@onready var jump_sound = $JumpSound
const SPEED = 130.0
@@ -66,6 +68,7 @@ func _process(delta):
# check pipe
if on_pipe and (Input.is_action_just_pressed("crawl") or crawl) and is_on_floor() or right_pipe and (Input.is_action_pressed("move_right") or t_velocity > 0):
pipe_sound.play()
crawl = false
t_velocity = 0
color_rect.visible = true
@@ -79,7 +82,8 @@ func _physics_process(delta):
velocity.y += gravity * delta
# Handle jump.
if not on_pause and (Input.is_action_just_pressed("jump") or jump) and is_on_floor():
if not on_pause and (Input.is_action_pressed("jump") or jump) and is_on_floor():
jump_sound.play()
jump = false
velocity.y = JUMPt_velocity
@@ -122,9 +126,10 @@ func _physics_process(delta):
move_and_slide()
func grow():
is_big = true
collision_shape_2d.shape.height = 32
pipedetector_ground.position.y += 8
if not is_big:
is_big = true
collision_shape_2d.shape.height = 32
pipedetector_ground.position.y += 8
func shrink():
if is_big:
@@ -154,6 +159,7 @@ func _on_pipedetector_right_area_exited(area):
func _on_pipe_timer_timeout():
on_pause = false
color_rect.visible = false
pipe_sound.play()
func _on_pipe_timer_half_timeout():