欢迎光临散文网 会员登陆 & 注册

《迷失岛2》游戏框架开发01:实现场景转换|Godot教程

2023-03-19 20:07 作者:瓦格良  | 我要投稿

Godot学习笔记


06:09


# 3.x的export(String,FILE,"*.tscn")换成4.x的@export_file("*.tscn")

@export_file("*.tscn") var target_path: String

func _interact():

# godot3.x中【.父类函数】 换成4.x的 【supser.父类函数】

super._interact()

# godot3.x中change_scene换成4.x的change_scene_to_file

get_tree().change_scene_to_file(target_path)



10:06


func change_scene(path: String):

var tween := get_tree().create_tween()

tween.tween_callback(color_rect.show)

tween.tween_property(color_rect,"color:a",1.0,0.2)

tween.tween_callback(get_tree().change_scene_to_file.bind(path))

tween.tween_property(color_rect,"color:a",0.0,0.3)

tween.tween_callback(color_rect.hide)





12:14


extends Interactable

class_name Teleporter


# 3.x的export(String,FILE,"*.tscn")换成4.x的@export_file("*.tscn")

@export_file("*.tscn") var target_path: String


func _interact():

# godot3.x中[.父类函数] 换成4.x的 [supser.父类函数]

super._interact()

# godot3.x中change_scene换成4.x的change_scene_to_file

SceneChanger.change_scene(target_path)

《迷失岛2》游戏框架开发01:实现场景转换|Godot教程的评论 (共 条)

分享到微博请遵守国家法律