From 54833d8f780322e0e35fe9be308bef29b72c6aa4 Mon Sep 17 00:00:00 2001 From: VAILLANT Jeremy Date: Sat, 8 May 2021 20:38:16 +0200 Subject: [PATCH] Add method for quit war scene and back to main --- .../rock floor/textures/tx_rock_floor_bc.tga.import | 5 +++-- scenes/levels/WarCraft.gd | 9 +++++++++ scenes/levels/WarCraft.tscn | 4 +++- 3 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 scenes/levels/WarCraft.gd diff --git a/assets/props/rock floor/textures/tx_rock_floor_bc.tga.import b/assets/props/rock floor/textures/tx_rock_floor_bc.tga.import index 80daca8..b02387a 100644 --- a/assets/props/rock floor/textures/tx_rock_floor_bc.tga.import +++ b/assets/props/rock floor/textures/tx_rock_floor_bc.tga.import @@ -4,15 +4,16 @@ importer="texture" type="StreamTexture" path.s3tc="res://.import/tx_rock_floor_bc.tga-4b77fe3e94f9498cc82b83553dd20905.s3tc.stex" path.etc2="res://.import/tx_rock_floor_bc.tga-4b77fe3e94f9498cc82b83553dd20905.etc2.stex" +path.etc="res://.import/tx_rock_floor_bc.tga-4b77fe3e94f9498cc82b83553dd20905.etc.stex" metadata={ -"imported_formats": [ "s3tc", "etc2" ], +"imported_formats": [ "s3tc", "etc2", "etc" ], "vram_texture": true } [deps] source_file="res://assets/props/rock floor/textures/tx_rock_floor_bc.tga" -dest_files=[ "res://.import/tx_rock_floor_bc.tga-4b77fe3e94f9498cc82b83553dd20905.s3tc.stex", "res://.import/tx_rock_floor_bc.tga-4b77fe3e94f9498cc82b83553dd20905.etc2.stex" ] +dest_files=[ "res://.import/tx_rock_floor_bc.tga-4b77fe3e94f9498cc82b83553dd20905.s3tc.stex", "res://.import/tx_rock_floor_bc.tga-4b77fe3e94f9498cc82b83553dd20905.etc2.stex", "res://.import/tx_rock_floor_bc.tga-4b77fe3e94f9498cc82b83553dd20905.etc.stex" ] [params] diff --git a/scenes/levels/WarCraft.gd b/scenes/levels/WarCraft.gd new file mode 100644 index 0000000..6c68e8a --- /dev/null +++ b/scenes/levels/WarCraft.gd @@ -0,0 +1,9 @@ +extends Spatial + +export (PackedScene) var main = load("res://scenes/main.tscn") + +func _notification(what): + # Back to main scene + if what == MainLoop.NOTIFICATION_WM_GO_BACK_REQUEST: + var scene = main.instance() + call_deferred("add_child", scene) diff --git a/scenes/levels/WarCraft.tscn b/scenes/levels/WarCraft.tscn index d20d5f1..3bb3167 100644 --- a/scenes/levels/WarCraft.tscn +++ b/scenes/levels/WarCraft.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=8 format=2] +[gd_scene load_steps=9 format=2] [ext_resource path="res://assets/props/rock floor/rock floor.gltf" type="PackedScene" id=1] [ext_resource path="res://assets/props/table/table.gltf" type="PackedScene" id=2] [ext_resource path="res://assets/props/stool b/stool b.gltf" type="PackedScene" id=3] [ext_resource path="res://assets/hdri/tx_night_place.hdr" type="Texture" id=4] [ext_resource path="res://assets/props/book/book.gltf" type="PackedScene" id=5] +[ext_resource path="res://scenes/levels/WarCraft.gd" type="Script" id=6] [sub_resource type="PanoramaSky" id=1] panorama = ExtResource( 4 ) @@ -15,6 +16,7 @@ background_sky = SubResource( 1 ) ambient_light_color = Color( 0.266667, 0.14902, 0.0627451, 1 ) [node name="Warcraft" type="Spatial"] +script = ExtResource( 6 ) [node name="rock floor" parent="." instance=ExtResource( 1 )] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 2.253 )