Browse Source

完整实现楼层跳跃器逻辑

master
freewu32 12 months ago
parent
commit
19a906b297
  1. 3
      Main.tscn
  2. 4
      export_presets.cfg
  3. 40
      src/hud/FlyDialog.gd
  4. 22
      src/levels/Level1.tscn

3
Main.tscn

@ -612,4 +612,7 @@ script = ExtResource( 10 )
stream = ExtResource( 5 )
volume_db = -10.0
[connection signal="popup_hide" from="HUD/BookDialog" to="HUD/BookDialog/ScrollContainer" method="_on_BookDialog_popup_hide"]
[connection signal="gui_input" from="HUD/FlyDialog/Screenshot" to="HUD/FlyDialog" method="_on_Screenshot_gui_input"]
[connection signal="pressed" from="HUD/FlyDialog/AddLevel" to="HUD/FlyDialog" method="_on_AddLevel_pressed"]
[connection signal="pressed" from="HUD/FlyDialog/SubLevel" to="HUD/FlyDialog" method="_on_SubLevel_pressed"]
[connection signal="pressed" from="HUD/FlyDialog/Close" to="HUD/FlyDialog" method="_on_Close_pressed"]

4
export_presets.cfg

@ -18,5 +18,5 @@ vram_texture_compression/for_desktop=true
vram_texture_compression/for_mobile=true
html/custom_html_shell=""
html/head_include=""
custom_template/release="D:/godot/source/godot/bin/godot.javascript.opt.64.zip"
custom_template/debug="D:/godot/source/godot/bin/godot.javascript.opt.64.zip"
custom_template/release=""
custom_template/debug=""

40
src/hud/FlyDialog.gd

@ -6,15 +6,43 @@ onready var level_label : Label = $"CurrentLevel"
onready var level_screenshot : TextureRect = $"Screenshot"
var display_level : int = -1
func show():
var current_level = level_manager.level
level_label.text = "魔塔 第%0*dF" % [2,current_level]
var image = get_viewport().get_texture().get_data()
image.flip_y()
var texture = ImageTexture.new()
texture.create_from_image(image,image.get_format())
level_screenshot.texture = texture
set_screenshot_by_level(current_level)
visible = true
func _on_Close_pressed():
visible = false
# 设置屏幕截图
func set_screenshot_by_level(level:int) -> void:
level_label.text = "魔塔 第%0*dF" % [2,level]
var image : Image = null
if level == level_manager.level:
image = get_viewport().get_texture().get_data()
else:
image = Image.new()
image.load(level_manager.get_screenshot_image_path(level))
image.flip_y()
var texture = ImageTexture.new()
texture.create_from_image(image,image.get_format())
level_screenshot.texture = texture
display_level = level
# 点击增加楼层
func _on_AddLevel_pressed():
if level_manager.get_go_to_levels().has(display_level + 1):
set_screenshot_by_level(display_level + 1)
# 点击减去楼层
func _on_SubLevel_pressed():
if level_manager.get_go_to_levels().has(display_level - 1):
set_screenshot_by_level(display_level - 1)
# 点击楼层截图视图回调
func _on_Screenshot_gui_input(event):
if event is InputEventMouseButton and event.pressed:
visible = false
level_manager.set_level(display_level)

22
src/levels/Level1.tscn

@ -27,6 +27,8 @@ occluder_light_mask = 0
format = 1
tile_data = PoolIntArray( 196608, 1, 0, 196609, 1, 0, 196610, 1, 0, 196611, 1, 0, 196612, 1, 0, 196613, 1, 0, 196614, 1, 0, 196615, 1, 0, 196616, 1, 0, 196617, 1, 0, 196618, 1, 0, 196619, 1, 0, 196620, 1, 0, 262144, 1, 0, 262145, 2, 0, 262146, 2, 0, 262147, 2, 0, 262148, 2, 0, 262149, 2, 0, 262150, 2, 0, 262151, 2, 0, 262152, 2, 0, 262153, 2, 0, 262154, 2, 0, 262155, 2, 0, 262156, 1, 0, 327680, 1, 0, 327681, 1, 0, 327682, 1, 0, 327683, 1, 0, 327684, 1, 0, 327685, 1, 0, 327686, 1, 0, 327687, 1, 0, 327688, 1, 0, 327689, 1, 0, 327690, 1, 0, 327691, 2, 0, 327692, 1, 0, 393216, 1, 0, 393217, 2, 0, 393218, 2, 0, 393219, 2, 0, 393220, 2, 0, 393221, 2, 0, 393222, 1, 0, 393223, 2, 0, 393224, 2, 0, 393225, 2, 0, 393226, 1, 0, 393227, 2, 0, 393228, 1, 0, 458752, 1, 0, 458753, 2, 0, 458754, 2, 0, 458755, 2, 0, 458756, 1, 0, 458757, 2, 0, 458758, 1, 0, 458759, 2, 0, 458760, 2, 0, 458761, 2, 0, 458762, 1, 0, 458763, 2, 0, 458764, 1, 0, 524288, 1, 0, 524289, 1, 0, 524290, 2, 0, 524291, 1, 0, 524292, 1, 0, 524293, 2, 0, 524294, 1, 0, 524295, 1, 0, 524296, 1, 0, 524297, 2, 0, 524298, 1, 0, 524299, 2, 0, 524300, 1, 0, 589824, 1, 0, 589825, 2, 0, 589826, 2, 0, 589827, 2, 0, 589828, 1, 0, 589829, 2, 0, 589830, 2, 0, 589831, 2, 0, 589832, 2, 0, 589833, 2, 0, 589834, 1, 0, 589835, 2, 0, 589836, 1, 0, 655360, 1, 0, 655361, 2, 0, 655362, 2, 0, 655363, 2, 0, 655364, 1, 0, 655365, 2, 0, 655366, 1, 0, 655367, 1, 0, 655368, 1, 0, 655369, 1, 0, 655370, 1, 0, 655371, 2, 0, 655372, 1, 0, 720896, 1, 0, 720897, 1, 0, 720898, 2, 0, 720899, 1, 0, 720900, 1, 0, 720901, 2, 0, 720902, 2, 0, 720903, 2, 0, 720904, 2, 0, 720905, 2, 0, 720906, 2, 0, 720907, 2, 0, 720908, 1, 0, 786432, 1, 0, 786433, 2, 0, 786434, 2, 0, 786435, 2, 0, 786436, 1, 0, 786437, 1, 0, 786438, 2, 0, 786439, 1, 0, 786440, 1, 0, 786441, 1, 0, 786442, 2, 0, 786443, 1, 0, 786444, 1, 0, 851968, 1, 0, 851969, 2, 0, 851970, 2, 0, 851971, 2, 0, 851972, 1, 0, 851973, 2, 0, 851974, 2, 0, 851975, 2, 0, 851976, 1, 0, 851977, 2, 0, 851978, 2, 0, 851979, 2, 0, 851980, 1, 0, 917504, 1, 0, 917505, 2, 0, 917506, 2, 0, 917507, 2, 0, 917508, 1, 0, 917509, 2, 0, 917510, 2, 0, 917511, 2, 0, 917512, 1, 0, 917513, 2, 0, 917514, 2, 0, 917515, 2, 0, 917516, 1, 0, 983040, 1, 0, 983041, 1, 0, 983042, 1, 0, 983043, 1, 0, 983044, 1, 0, 983045, 1, 0, 983046, 1, 0, 983047, 1, 0, 983048, 1, 0, 983049, 1, 0, 983050, 1, 0, 983051, 1, 0, 983052, 1, 0 )
script = ExtResource( 4 )
navigation_cell_index = 2
wall_cell_index = 1
changed_cells = {
}
@ -35,21 +37,33 @@ changed_cells = {
[node name="YellowDoor" parent="Items" instance=ExtResource( 8 )]
position = Vector2( 208, 400 )
need_key_type = "yellow_key"
enabled = true
[node name="YellowDoor2" parent="Items" instance=ExtResource( 8 )]
position = Vector2( 336, 400 )
need_key_type = "yellow_key"
enabled = true
[node name="YellowDoor3" parent="Items" instance=ExtResource( 8 )]
position = Vector2( 80, 368 )
need_key_type = "yellow_key"
enabled = true
[node name="YellowDoor4" parent="Items" instance=ExtResource( 8 )]
position = Vector2( 82.1, 272 )
need_key_type = "yellow_key"
enabled = true
[node name="YellowDoor5" parent="Items" instance=ExtResource( 8 )]
position = Vector2( 144, 208 )
need_key_type = "yellow_key"
enabled = true
[node name="YellowDoor6" parent="Items" instance=ExtResource( 8 )]
position = Vector2( 208, 304 )
need_key_type = "yellow_key"
enabled = true
[node name="RedGemstone" parent="Items" instance=ExtResource( 9 )]
position = Vector2( 240, 240 )
@ -71,6 +85,8 @@ position = Vector2( 48, 464 )
[node name="YellowDoor7" parent="Items" instance=ExtResource( 8 )]
position = Vector2( 304, 272 )
need_key_type = "yellow_key"
enabled = true
[node name="YellowKey" parent="Items" instance=ExtResource( 7 )]
position = Vector2( 173.9, 432 )
@ -89,7 +105,6 @@ position = Vector2( 114.1, 432 )
[node name="Monster" parent="Items" instance=ExtResource( 6 )]
position = Vector2( 112, 144 )
frame = 0
[node name="Monster2" parent="Items" instance=ExtResource( 6 )]
position = Vector2( 144, 144 )
@ -121,15 +136,12 @@ animation = "skeletonSoilder"
[node name="Monster5" parent="Items" instance=ExtResource( 6 )]
position = Vector2( 304, 464 )
frame = 0
[node name="Monster6" parent="Items" instance=ExtResource( 6 )]
position = Vector2( 368, 464 )
frame = 0
[node name="Monster3" parent="Items" instance=ExtResource( 6 )]
position = Vector2( 176, 144 )
frame = 0
[node name="Stairs" parent="Items" instance=ExtResource( 3 )]
position = Vector2( 48, 144 )
@ -140,6 +152,6 @@ position = Vector2( 240, 208 )
[node name="FlyingStaff" parent="Items" instance=ExtResource( 13 )]
[node name="Player" parent="." instance=ExtResource( 1 )]
position = Vector2( 80, 400 )
position = Vector2( 208, 464 )
atk = 100
def = 100

Loading…
Cancel
Save