This section renderings
This section is increased audio, please fill the following figure combined with brain
extends Node
func play(name : String):
var sfx = find_node(name)
if sfx is AudioStreamPlayer:
sfx.play()
# Bird.gd
extends RigidBody2D
func _ready():
connect("body_entered",self,"on_body_entered")
func _physics_process(delta):
if Input.is_mouse_button_pressed(1):
AudioManager.play("sfx_swooshing")#音效
linear_velocity = Vector2.UP*500
angular_velocity = -3.0
if rotation_degrees < -30:
rotation_degrees = -30
angular_velocity = 0
if linear_velocity.y > 0.0:
angular_velocity = 1.5
func on_body_entered(_body):
if _body is StaticBody2D:
AudioManager.play("sfx_hit")#音效
print("Die.....")
#ScoreArea.gd
extends Area2D
func _ready():
connect("body_exited",self,"_on_body_exited")
func _on_body_exited(_body):
if _body.name == "Bird":
AudioManager.play("sfx_point")#音效
print("得分!!!!")