ajout d'un portail teleportant dans une autre map.

This commit is contained in:
osquallo 2018-08-20 11:26:50 +02:00
parent 79a3c7293c
commit f79acce70a
5 changed files with 165 additions and 4 deletions

14
portail.gd Normal file
View file

@ -0,0 +1,14 @@
extends Spatial
func _on_area_body_shape_entered(body_id, body, body_shape, area_shape):
print( "PORTAIL AREA BODY SHAPE ENTERED !!!!!" )
print( "body_id: "+str(body_id) )
print( "body: "+str(body) )
print( "body_shape: "+str(body_shape) )
print( "area_shape: "+str(area_shape) )
if body == character:
global.change_level( "game", "res://test_scene/test_scene.tscn", null, global.current_map )

View file

@ -12,7 +12,7 @@
[ext_resource path="res://scenes/GUI/HUD/trauma.gd" type="Script" id=10]
[ext_resource path="res://scenes/GUI/HUD/douleur.gd" type="Script" id=11]
[node name="HUD" type="MarginContainer" index="0"]
[node name="HUD" type="MarginContainer"]
anchor_left = 0.0
anchor_top = 0.0

View file

@ -67,7 +67,7 @@ _sections_unfolded = [ "shader_param" ]
radius = 0.520354
[node name="Character" type="KinematicBody" index="0"]
[node name="Character" type="KinematicBody"]
transform = Transform( 0.371345, 0, 0, 0, 0.218854, 0, 0, 0, 0.371345, -0.00167466, -0.475751, 6.02408 )
input_ray_pickable = true

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=49 format=2]
[gd_scene load_steps=50 format=2]
[ext_resource path="res://scenes/Game/WorldEnvironment.gd" type="Script" id=1]
[ext_resource path="res://assets/test/sky_box.jpg" type="Texture" id=2]
@ -13,6 +13,7 @@
[ext_resource path="res://assets/Game/textures/fire_01.png" type="Texture" id=11]
[ext_resource path="res://assets/Game/textures/fire_02.png" type="Texture" id=12]
[ext_resource path="res://scenes/Game/jukebox/jukebox.tscn" type="PackedScene" id=13]
[ext_resource path="res://scenes/Game/portail/portail.tscn" type="PackedScene" id=14]
[sub_resource type="ProceduralSky" id=1]
@ -1011,7 +1012,7 @@ material = SubResource( 32 )
custom_aabb = AABB( 0, 0, 0, 0, 0, 0 )
size = Vector2( 0.4, 0.4 )
[node name="Game" type="Spatial" index="0"]
[node name="Game" type="Spatial"]
_sections_unfolded = [ "Transform" ]
@ -1021,6 +1022,7 @@ _sections_unfolded = [ "Transform", "Visibility" ]
[node name="WorldEnvironment" type="WorldEnvironment" parent="World" index="0"]
editor/display_folded = true
environment = SubResource( 2 )
script = ExtResource( 1 )
@ -1331,6 +1333,10 @@ draw_pass_2 = SubResource( 33 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -7.67816, 0.00211585, 0 )
[node name="portail" parent="World" index="9" instance=ExtResource( 14 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 12.1976 )
[connection signal="sleeping_state_changed" from="World/Box" to="World/Box" method="_on_Box_sleeping_state_changed"]
[connection signal="sleeping_state_changed" from="World/Box2" to="World/Box2" method="_on_Box_sleeping_state_changed"]

View file

@ -0,0 +1,141 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://portail.gd" type="Script" id=1]
[sub_resource type="CubeMesh" id=1]
custom_aabb = AABB( 0, 0, 0, 0, 0, 0 )
size = Vector3( 2, 2, 2 )
subdivide_width = 0
subdivide_height = 0
subdivide_depth = 0
[sub_resource type="SpatialMaterial" id=3]
render_priority = 0
flags_transparent = false
flags_unshaded = false
flags_vertex_lighting = false
flags_no_depth_test = false
flags_use_point_size = false
flags_world_triplanar = false
flags_fixed_size = false
flags_albedo_tex_force_srgb = false
vertex_color_use_as_albedo = false
vertex_color_is_srgb = false
params_diffuse_mode = 0
params_specular_mode = 0
params_blend_mode = 0
params_cull_mode = 0
params_depth_draw_mode = 0
params_line_width = 1.0
params_point_size = 1.0
params_billboard_mode = 0
params_grow = false
params_use_alpha_scissor = false
albedo_color = Color( 0.589844, 0.589844, 0.589844, 1 )
metallic = 1.0
metallic_specular = 0.5
metallic_texture_channel = 0
roughness = 0.2
roughness_texture_channel = 0
emission_enabled = false
normal_enabled = false
rim_enabled = false
clearcoat_enabled = false
anisotropy_enabled = false
ao_enabled = false
depth_enabled = false
subsurf_scatter_enabled = false
transmission_enabled = false
refraction_enabled = false
detail_enabled = false
uv1_scale = Vector3( 1, 1, 1 )
uv1_offset = Vector3( 0, 0, 0 )
uv1_triplanar = false
uv1_triplanar_sharpness = 1.0
uv2_scale = Vector3( 1, 1, 1 )
uv2_offset = Vector3( 0, 0, 0 )
uv2_triplanar = false
uv2_triplanar_sharpness = 1.0
proximity_fade_enable = false
distance_fade_enable = false
_sections_unfolded = [ "Albedo", "Metallic", "Roughness" ]
[sub_resource type="ConvexPolygonShape" id=2]
points = PoolVector3Array( -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1 )
[node name="portail" type="Spatial" index="0"]
script = ExtResource( 1 )
[node name="mesh_instance" type="MeshInstance" parent="." index="0"]
transform = Transform( 1.86317, 0, 0, 0, 2.71355, 0, 0, 0, 0.105108, 0, 2.64718, 0 )
layers = 1
material_override = null
cast_shadow = 1
extra_cull_margin = 0.0
use_in_baked_light = false
lod_min_distance = 0.0
lod_min_hysteresis = 0.0
lod_max_distance = 0.0
lod_max_hysteresis = 0.0
mesh = SubResource( 1 )
skeleton = NodePath("..")
material/0 = SubResource( 3 )
_sections_unfolded = [ "material" ]
[node name="static_body" type="StaticBody" parent="mesh_instance" index="0"]
input_ray_pickable = true
input_capture_on_drag = false
collision_layer = 1
collision_mask = 1
friction = 1.0
bounce = 0.0
constant_linear_velocity = Vector3( 0, 0, 0 )
constant_angular_velocity = Vector3( 0, 0, 0 )
[node name="collision_shape" type="CollisionShape" parent="mesh_instance/static_body" index="0"]
shape = SubResource( 2 )
disabled = false
[node name="area" type="Area" parent="mesh_instance" index="1"]
input_ray_pickable = false
input_capture_on_drag = false
space_override = 0
gravity_point = false
gravity_distance_scale = 0.0
gravity_vec = Vector3( 0, -1, 0 )
gravity = 9.8
linear_damp = 0.1
angular_damp = 1.0
priority = 0.0
monitoring = true
monitorable = true
collision_layer = 1
collision_mask = 1
audio_bus_override = false
audio_bus_name = "Master"
reverb_bus_enable = false
reverb_bus_name = "Master"
reverb_bus_amount = 0.0
reverb_bus_uniformity = 0.0
[node name="collision_shape2" type="CollisionShape" parent="mesh_instance/area" index="0"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 9.40695, 0, 0, 0 )
shape = SubResource( 2 )
disabled = false
[connection signal="area_entered" from="mesh_instance/area" to="." method="_on_area_area_entered"]
[connection signal="body_entered" from="mesh_instance/area" to="." method="_on_area_body_entered"]
[connection signal="body_shape_entered" from="mesh_instance/area" to="." method="_on_area_body_shape_entered"]