[ハンズあなたとゴドーゲーム開発] FlappyBird:6ポイントMUSICまで(未完成)

このセクションでレンダリング

このセクションでは、オーディオ増加し、脳と組み合わせて、次の図を記入してください

ここに画像を挿入説明

ここに画像を挿入説明

ここに画像を挿入説明

ここに画像を挿入説明

ここに画像を挿入説明

ここに画像を挿入説明

ここに画像を挿入説明

ここに画像を挿入説明

ここに画像を挿入説明

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("得分!!!!")
公開された375元の記事 ウォンの賞賛1037 ビュー17万+

おすすめ

転載: blog.csdn.net/hello_tute/article/details/104990374