mirror of
https://gitee.com/freeyz/godot-mota.git
synced 2025-01-24 11:21:30 +08:00
离开楼层时增加屏幕截图
This commit is contained in:
parent
bd5b5a3379
commit
88ad7de89e
@ -27,6 +27,7 @@ func get_current_level_instance() -> LevelInstance:
|
||||
# 设置楼层
|
||||
func set_level(next_level:int):
|
||||
#保存数据
|
||||
save_screenshot()
|
||||
save_instance_to_local()
|
||||
save_data_to_local()
|
||||
load_data(next_level)
|
||||
@ -41,6 +42,14 @@ func load_data(next_level:int):
|
||||
#设置数据
|
||||
level = next_level
|
||||
|
||||
# 保存当前楼层的屏幕截图
|
||||
func save_screenshot():
|
||||
var image = get_viewport().get_texture().get_data()
|
||||
image.flip_y()
|
||||
var save_error = image.save_png("%s%s.png" % [tmp_level_scene_path,level])
|
||||
if save_error != OK:
|
||||
print("保存截图失败:"+save_error)
|
||||
|
||||
# 设置楼层和位置
|
||||
func set_level_and_position(next_level:int,position:Vector2):
|
||||
set_level(next_level)
|
||||
|
Loading…
x
Reference in New Issue
Block a user