[Hands with you Godot game development] FlappyBird: 6 to point MUSIC (unfinished)

This section renderings

This section is increased audio, please fill the following figure combined with brain

Here Insert Picture Description

Here Insert Picture Description

Here Insert Picture Description

Here Insert Picture Description

Here Insert Picture Description

Here Insert Picture Description

Here Insert Picture Description

Here Insert Picture Description

Here Insert Picture Description

extends Node

func play(name : String):
	var sfx = find_node(name)
	if sfx is AudioStreamPlayer:
		sfx.play()

Here Insert Picture Description

Here Insert Picture Description

Here Insert Picture Description

Here Insert Picture Description

Here Insert Picture Description

# 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("得分!!!!")
Published 375 original articles · won praise 1037 · Views 170,000 +

Guess you like

Origin blog.csdn.net/hello_tute/article/details/104990374