wip: ajout du choix de la position d'arriver du portail.

This commit is contained in:
osquallo 2018-08-21 11:40:29 +02:00
parent dbb1124c17
commit 0d1019614e
9 changed files with 52 additions and 133 deletions

View file

@ -23,7 +23,7 @@ cell_scale = 1.0
collision_layer = 1 collision_layer = 1
collision_mask = 1 collision_mask = 1
data = { data = {
"cells": PoolIntArray( 3, 0, 655361, 5, 0, -1073086463, 65535, 0, -1609564157, 2, 65534, -1073741823, 4, 65534, -1610612735, 0, 65535, 1441797, 1, 65535, 1441797, 2, 65535, 1441798, 3, 65535, 1048582, 4, 65535, -2146041850, 5, 65535, 1048582, 6, 65535, -1072300031, 65535, 65535, 1611661314 ) "cells": PoolIntArray( 3, 0, 655361, 5, 0, 655361, 65535, 0, 1074790403, 2, 65534, 1, 4, 65534, 1, 0, 65535, 1441797, 1, 65535, 1441797, 2, 65535, 1441798, 3, 65535, 1048582, 4, 65535, 1441798, 5, 65535, 1048582, 6, 65535, 1441793, 65535, 65535, 1048578 )
} }
_sections_unfolded = [ "Cell" ] _sections_unfolded = [ "Cell" ]
__meta__ = { __meta__ = {
@ -33,6 +33,6 @@ __meta__ = {
[node name="portail" parent="world" index="1" instance=ExtResource( 2 )] [node name="portail" parent="world" index="1" instance=ExtResource( 2 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -1.65801, 0, 3.40425 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -1.65801, 0, 3.40425 )
scene_path = "res://game_scene/game_scene.tscn" scene_path = NodePath("res://scenes/Game/Game.tscn")

View file

@ -1,144 +1,58 @@
[gd_scene load_steps=10 format=2] [gd_scene load_steps=6 format=2]
[ext_resource path="res://assets/Game/basekits/dispensaire_scenes/DisCor1wDoLRAA01.tscn" type="PackedScene" id=1] [ext_resource path="res://assets/Game/basekits/dispensaire_scenes/DisCor1wDoLRAA01.tscn" type="PackedScene" id=1]
[ext_resource path="res://assets/Game/basekits/dispensaire_mesh_sources/DisCor1wDoLRAA01.mesh" type="ArrayMesh" id=2] [ext_resource path="res://assets/Game/basekits/dispensaire_scenes/DisCor2wDoLAA01.tscn" type="PackedScene" id=2]
[ext_resource path="res://assets/Game/basekits/dispensaire_scenes/DisCor2wDoLAA01.tscn" type="PackedScene" id=3] [ext_resource path="res://assets/Game/basekits/dispensaire_scenes/DisCor1wAA01.tscn" type="PackedScene" id=3]
[ext_resource path="res://assets/Game/basekits/dispensaire_mesh_sources/DisCor2wDoLAA01.mesh" type="ArrayMesh" id=4] [ext_resource path="res://assets/Game/basekits/dispensaire_scenes/DisCor2wDoLRAA01.tscn" type="PackedScene" id=4]
[ext_resource path="res://assets/Game/basekits/dispensaire_scenes/DisCor1wAA01.tscn" type="PackedScene" id=5] [ext_resource path="res://scenes/Game/portail/portail.tscn" type="PackedScene" id=5]
[ext_resource path="res://assets/Game/basekits/dispensaire_mesh_sources/DisCor1wAA01.mesh" type="ArrayMesh" id=6]
[ext_resource path="res://assets/Game/basekits/dispensaire_scenes/DisCor2wDoLRAA01.tscn" type="PackedScene" id=7]
[ext_resource path="res://assets/Game/basekits/dispensaire_mesh_sources/DisCor2wDoLRAA01.mesh" type="ArrayMesh" id=8]
[ext_resource path="res://scenes/Game/portail/portail.tscn" type="PackedScene" id=9]
[node name="dispensaire_scenes" type="Node" index="0"] [node name="dispensaire_scenes" type="Node"]
[node name="world" type="Spatial" parent="." index="0"] [node name="world" type="Spatial" parent="." index="0"]
editor/display_folded = true editor/display_folded = true
[node name="DisCor1wDoLRAA01" type="MeshInstance" parent="world" index="0" instance=ExtResource( 1 )] [node name="DisCor1wDoLRAA01" parent="world" index="0" instance=ExtResource( 1 )]
transform = Transform( -1, 0, -8.74228e-008, 0, 1, 0, 8.74228e-008, 0, -1, -1, 0, 0 ) transform = Transform( -1, 0, -8.74228e-008, 0, 1, 0, 8.74228e-008, 0, -1, -1, 0, 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 = ExtResource( 2 )
skeleton = NodePath("..")
material/0 = null
material/1 = null
material/2 = null
material/3 = null
material/4 = null
material/5 = null
material/6 = null
[node name="DisCor2wDoLAA01" type="MeshInstance" parent="world/DisCor1wDoLRAA01" index="1" instance=ExtResource( 3 )] [node name="DisCor2wDoLAA01" parent="world/DisCor1wDoLRAA01" index="1" instance=ExtResource( 2 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 3.49329, -2.38419e-007, 3.49498 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 3.49329, -2.38419e-007, 3.49498 )
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 = ExtResource( 4 )
skeleton = NodePath("..")
material/0 = null
material/1 = null
material/2 = null
material/3 = null
material/4 = null
[node name="DisCor1wAA01" type="MeshInstance" parent="world/DisCor1wDoLRAA01/DisCor2wDoLAA01" index="1" instance=ExtResource( 5 )] [node name="DisCor1wAA01" parent="world/DisCor1wDoLRAA01/DisCor2wDoLAA01" index="1" instance=ExtResource( 3 )]
transform = Transform( -4.37114e-008, 0, 1, 0, 1, 0, -1, 0, -4.37114e-008, -3.50318, -9.72748e-005, -0.00448728 ) transform = Transform( -4.37114e-008, 0, 1, 0, 1, 0, -1, 0, -4.37114e-008, -3.50318, -9.72748e-005, -0.00448728 )
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 = ExtResource( 6 )
skeleton = NodePath("..")
material/0 = null
material/1 = null
material/2 = null
material/3 = null
material/4 = null
[node name="DisCor2wDoLAA02" parent="world/DisCor1wDoLRAA01" index="2" instance=ExtResource( 3 )] [node name="DisCor2wDoLAA02" parent="world/DisCor1wDoLRAA01" index="2" instance=ExtResource( 2 )]
transform = Transform( -1, 0, -1.50996e-007, 0, 1, 0, 1.50996e-007, 0, -1, 3.49329, -2.38419e-007, 6.98099 ) transform = Transform( -1, 0, -1.50996e-007, 0, 1, 0, 1.50996e-007, 0, -1, 3.49329, -2.38419e-007, 6.98099 )
[node name="DisCor1wAA01" parent="world/DisCor1wDoLRAA01/DisCor2wDoLAA02" index="1" instance=ExtResource( 5 )] [node name="DisCor1wAA01" parent="world/DisCor1wDoLRAA01/DisCor2wDoLAA02" index="1" instance=ExtResource( 3 )]
transform = Transform( -4.37114e-008, 0, 1, 0, 1, 0, -1, 0, -4.37114e-008, -3.50318, -9.72748e-005, -0.00448728 ) transform = Transform( -4.37114e-008, 0, 1, 0, 1, 0, -1, 0, -4.37114e-008, -3.50318, -9.72748e-005, -0.00448728 )
[node name="DisCor2wDoLAA03" parent="world/DisCor1wDoLRAA01" index="3" instance=ExtResource( 3 )] [node name="DisCor2wDoLAA03" parent="world/DisCor1wDoLRAA01" index="3" instance=ExtResource( 2 )]
transform = Transform( 1, 0, 2.38419e-007, 0, 1, 0, -2.38419e-007, 0, 1, 3.49329, -2.38419e-007, 10.4804 ) transform = Transform( 1, 0, 2.38419e-007, 0, 1, 0, -2.38419e-007, 0, 1, 3.49329, -2.38419e-007, 10.4804 )
[node name="DisCor1wAA01" parent="world/DisCor1wDoLRAA01/DisCor2wDoLAA03" index="1" instance=ExtResource( 5 )] [node name="DisCor1wAA01" parent="world/DisCor1wDoLRAA01/DisCor2wDoLAA03" index="1" instance=ExtResource( 3 )]
transform = Transform( -4.37114e-008, 0, 1, 0, 1, 0, -1, 0, -4.37114e-008, -3.50318, -9.72748e-005, -0.00448728 ) transform = Transform( -4.37114e-008, 0, 1, 0, 1, 0, -1, 0, -4.37114e-008, -3.50318, -9.72748e-005, -0.00448728 )
[node name="DisCor1wAA01" type="MeshInstance" parent="world/DisCor1wDoLRAA01/DisCor2wDoLAA03/DisCor1wAA01" index="1" instance=ExtResource( 5 )] [node name="DisCor1wAA01" parent="world/DisCor1wDoLRAA01/DisCor2wDoLAA03/DisCor1wAA01" index="1" instance=ExtResource( 3 )]
transform = Transform( -4.37114e-008, 0, 1, 0, 1, 0, -1, 0, -4.37114e-008, -3.48495, 9.75132e-005, 3.50005 ) transform = Transform( -4.37114e-008, 0, 1, 0, 1, 0, -1, 0, -4.37114e-008, -3.48495, 9.75132e-005, 3.50005 )
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 = ExtResource( 6 )
skeleton = NodePath("..")
material/0 = null
material/1 = null
material/2 = null
material/3 = null
material/4 = null
[node name="DisCor2wDoLRAA01" type="MeshInstance" parent="world" index="1" instance=ExtResource( 7 )] [node name="DisCor2wDoLRAA01" parent="world" index="1" instance=ExtResource( 4 )]
transform = Transform( -1, 0, -8.74228e-008, 0, 1, 0, 8.74228e-008, 0, -1, -4.48443, 0, 0.0136418 ) transform = Transform( -1, 0, -8.74228e-008, 0, 1, 0, 8.74228e-008, 0, -1, -4.48443, 0, 0.0136418 )
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 = ExtResource( 8 )
skeleton = NodePath("..")
material/0 = null
material/1 = null
material/2 = null
material/3 = null
material/4 = null
material/5 = null
[node name="portail" parent="." index="1" instance=ExtResource( 9 )] [node name="portail" parent="." index="1" instance=ExtResource( 5 )]
transform = Transform( -4.37114e-008, 0, -1, 0, 1, 0, 1, 0, -4.37114e-008, 0.679648, -1, 2.97083e-008 ) transform = Transform( -4.37114e-008, 0, -1, 0, 1, 0, 1, 0, -4.37114e-008, 0.679648, -1, 2.97083e-008 )
scene_path = "res://game_scene/game_scene.tscn" scene_path = NodePath("res://scenes/Game/Game.tscn")
start_position_path = NodePath("World/portail_scenes/start_position")
[node name="start_position" type="Spatial" parent="." index="2"] [node name="start_position" type="Spatial" parent="." index="2"]

View file

@ -5,7 +5,7 @@ signal logout_button_pressed
const WINDOW_TITLE_INPUT = "GUI/Settings/Menus/TabContainer/Test/ScrollContainer/VBoxContainer/TitleBox/Title" const WINDOW_TITLE_INPUT = "GUI/Settings/Menus/TabContainer/Test/ScrollContainer/VBoxContainer/TitleBox/Title"
func _ready(): func _ready():
change_title() # change_title()
get_tree().get_root().connect("size_changed", self, "on_window_size_changed") get_tree().get_root().connect("size_changed", self, "on_window_size_changed")
# character.get_node( "MeshInstance" ).get_surface_material(0).set_shader_param( "albedo", global.character_color ) # character.get_node( "MeshInstance" ).get_surface_material(0).set_shader_param( "albedo", global.character_color )

View file

@ -12,6 +12,6 @@ _sections_unfolded = [ "Pause" ]
[node name="start_position" type="Spatial" parent="." index="1"] [node name="start_position" type="Spatial" parent="." index="1"]
transform = Transform( -0.750826, 0, -0.660501, 0, 1, 0, 0.660501, 0, -0.750826, 0.290986, 0, -15.5888 ) transform = Transform( -0.750826, 0, -0.660501, 0, 1, 0, 0.660501, 0, -0.750826, -3.30032, 0, -21.351 )

View file

@ -21,6 +21,7 @@ var current_scene = null
var old_scene = null var old_scene = null
var parent_scene = null var parent_scene = null
var current_map = null var current_map = null
var current_start_position = "start_position"
var current_state = "login" var current_state = "login"
@ -67,7 +68,7 @@ func load_scene( scene_path ):
return false return false
return true return true
func change_level( p_next_state, p_next_scene_path, p_parent_next_scene = null, p_old_scene = null ): func change_level( p_next_state, p_next_scene_path, p_parent_next_scene = null, p_old_scene = null, p_start_position = "start_position" ):
character.hide() character.hide()
get_node("background_loader").show() get_node("background_loader").show()
@ -80,6 +81,8 @@ func change_level( p_next_state, p_next_scene_path, p_parent_next_scene = null,
# print( " on "+ str(p_parent_next_scene.name) ) # print( " on "+ str(p_parent_next_scene.name) )
# print() # print()
self.current_start_position = p_start_position
if not load_scene( p_next_scene_path ): if not load_scene( p_next_scene_path ):
show_error() show_error()
return return
@ -157,8 +160,12 @@ func set_new_scene( scene_resource ):
else: else:
get_tree().get_root().add_child(scene) get_tree().get_root().add_child(scene)
if scene.has_node("start_position"): print( "scene: "+str(scene.name) )
character.update( scene.get_node("start_position") ) print( "start position: " + str(self.current_start_position ) )
if scene.has_node( self.current_start_position ):
print( "OK" )
character.update( scene.get_node( self.current_start_position ) )
current_map = scene current_map = scene
get_node("background_loader").hide() get_node("background_loader").hide()

View file

@ -1,15 +1,10 @@
extends Spatial extends Spatial
export( String ) var scene_path = "" export( NodePath ) var scene_path = ""
export( NodePath ) var start_position_path = "start_position"
func _on_area_body_shape_entered(body_id, body, body_shape, area_shape): 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 and not scene_path == "": if body == character and not scene_path == "":
# global.change_level( "game", "res://test_scene/test_scene.tscn", null, global.current_map ) global.change_level( "game", scene_path, null, global.current_map, start_position_path )
global.change_level( "game", scene_path, null, global.current_map )

View file

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

View file

@ -1337,12 +1337,18 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -7.67816, 0.00211585, 0 )
[node name="portail_scenes" parent="World" index="9" instance=ExtResource( 14 )] [node name="portail_scenes" parent="World" index="9" instance=ExtResource( 14 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 12.1976 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 12.1976 )
scene_path = "res://dispensaire_scenes/dispensaire_scenes.tscn" _sections_unfolded = [ "Transform", "Visibility" ]
scene_path = NodePath("res://dispensaire_scenes/dispensaire_scenes.tscn")
[node name="start_position" type="Spatial" parent="World/portail_scenes" index="1"]
transform = Transform( -1, 0, -1.50996e-007, 0, 1, 0, 1.50996e-007, 0, -1, 0.282988, 2.34225, -2.47697 )
_sections_unfolded = [ "Transform" ]
[node name="portail_gridmap" parent="World" index="10" instance=ExtResource( 14 )] [node name="portail_gridmap" parent="World" index="10" instance=ExtResource( 14 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -5.01158, 0, 12.1976 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -5.01158, 0, 12.1976 )
scene_path = "res://dispensaire_gridmap/dispensaire_gridmap.tscn" scene_path = NodePath("res://dispensaire_gridmap/dispensaire_gridmap.tscn")
[connection signal="sleeping_state_changed" from="World/Box" to="World/Box" method="_on_Box_sleeping_state_changed"] [connection signal="sleeping_state_changed" from="World/Box" to="World/Box" method="_on_Box_sleeping_state_changed"]

View file

@ -10,7 +10,7 @@ subdivide_width = 0
subdivide_height = 0 subdivide_height = 0
subdivide_depth = 0 subdivide_depth = 0
[sub_resource type="SpatialMaterial" id=3] [sub_resource type="SpatialMaterial" id=2]
render_priority = 0 render_priority = 0
flags_transparent = false flags_transparent = false
@ -62,7 +62,7 @@ proximity_fade_enable = false
distance_fade_enable = false distance_fade_enable = false
_sections_unfolded = [ "Albedo", "Metallic", "Roughness" ] _sections_unfolded = [ "Albedo", "Metallic", "Roughness" ]
[sub_resource type="ConvexPolygonShape" id=2] [sub_resource type="ConvexPolygonShape" id=3]
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 ) 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 )
@ -70,6 +70,7 @@ points = PoolVector3Array( -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1,
script = ExtResource( 1 ) script = ExtResource( 1 )
scene_path = "" scene_path = ""
start_position_path = "start_position"
[node name="mesh_instance" type="MeshInstance" parent="." index="0"] [node name="mesh_instance" type="MeshInstance" parent="." index="0"]
@ -85,7 +86,7 @@ lod_max_distance = 0.0
lod_max_hysteresis = 0.0 lod_max_hysteresis = 0.0
mesh = SubResource( 1 ) mesh = SubResource( 1 )
skeleton = NodePath("..") skeleton = NodePath("..")
material/0 = SubResource( 3 ) material/0 = SubResource( 2 )
_sections_unfolded = [ "material" ] _sections_unfolded = [ "material" ]
[node name="static_body" type="StaticBody" parent="mesh_instance" index="0"] [node name="static_body" type="StaticBody" parent="mesh_instance" index="0"]
@ -101,7 +102,7 @@ constant_angular_velocity = Vector3( 0, 0, 0 )
[node name="collision_shape" type="CollisionShape" parent="mesh_instance/static_body" index="0"] [node name="collision_shape" type="CollisionShape" parent="mesh_instance/static_body" index="0"]
shape = SubResource( 2 ) shape = SubResource( 3 )
disabled = false disabled = false
[node name="area" type="Area" parent="mesh_instance" index="1"] [node name="area" type="Area" parent="mesh_instance" index="1"]
@ -130,13 +131,9 @@ reverb_bus_uniformity = 0.0
[node name="collision_shape2" type="CollisionShape" parent="mesh_instance/area" index="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 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 9.40695, 0, 0, 0 )
shape = SubResource( 2 ) shape = SubResource( 3 )
disabled = false 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"] [connection signal="body_shape_entered" from="mesh_instance/area" to="." method="_on_area_body_shape_entered"]