adding raference
This commit is contained in:
parent
80c67686b9
commit
460289025b
27 changed files with 1114 additions and 69 deletions
Binary file not shown.
|
@ -6,6 +6,8 @@ var player_name = null
|
|||
|
||||
var ressource_queue = preload("res://ressources/scripts/resource_queue.gd").new()
|
||||
|
||||
var player = {}
|
||||
|
||||
enum RACE {
|
||||
arche,
|
||||
human
|
||||
|
|
|
@ -5,4 +5,3 @@
|
|||
[node name="spatial" type="Spatial"]
|
||||
|
||||
[node name="creature" parent="." instance=ExtResource( 1 )]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://assets/creatures/arche/arche.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://scenes/creature_creation/raference.tscn" type="PackedScene" id=2]
|
||||
|
||||
[node name="spatial" type="Spatial"]
|
||||
|
||||
[node name="arche" parent="." instance=ExtResource( 1 )]
|
||||
[node name="creature_1" parent="." instance=ExtResource( 1 )]
|
||||
visible = false
|
||||
|
||||
[node name="creature" parent="." instance=ExtResource( 2 )]
|
||||
|
|
|
@ -4,6 +4,7 @@ extends Spatial
|
|||
var animation_object = null
|
||||
var orientation = 0.0
|
||||
var blend_shapes = {}
|
||||
var idle_animation = "idle"
|
||||
|
||||
|
||||
func search_animation( obj ) -> bool:
|
||||
|
@ -30,7 +31,6 @@ func list_child( obj, father = "" ):
|
|||
list_child( i, root)
|
||||
|
||||
|
||||
|
||||
func list_blend_shapes( obj, father = "" ) -> Array:
|
||||
var ret:Array
|
||||
for i in obj.get_children():
|
||||
|
@ -69,13 +69,24 @@ func update_blend_shapes( obj ):
|
|||
func _ready():
|
||||
$control.connect("update_blend" , self, "_on_update_property")
|
||||
$control.connect( "select_race", self, "_on_select_race" )
|
||||
self.change_creature( "res://scenes/creature_creation/arche.tscn" )
|
||||
self.change_creature( "res://scenes/creature_creation/raference.tscn" )
|
||||
idle_animation = "_bip01_ca_female_idle"
|
||||
search_animation(self)
|
||||
#Config.msg_debug("Start Animation")
|
||||
animation_object.play( idle_animation )
|
||||
animation_object.connect("animation_finished", self, "_on_AnimationPlayer_animation_finished")
|
||||
update_blend_shapes($creature)
|
||||
|
||||
func _on_AnimationPlayer_animation_finished(anim_name):
|
||||
Config.msg_debug("Animation finished:" + anim_name)
|
||||
animation_object.play( anim_name )
|
||||
|
||||
func _process( delta ):
|
||||
animation_object.play( "idle" )
|
||||
# _bip01_ca_female_idle
|
||||
#if idle_animation:
|
||||
# animation_object.play( idle_animation )
|
||||
# animation_object.play( "idle" )
|
||||
pass
|
||||
|
||||
|
||||
func _input( event ):
|
||||
|
@ -101,12 +112,20 @@ func _on_select_race( race_sex_selected ):
|
|||
Config.msg_debug(race_sex_selected)
|
||||
match race_sex_selected:
|
||||
"arche":
|
||||
idle_animation = "idle"
|
||||
self.change_creature( "res://scenes/creature_creation/arche.tscn" )
|
||||
"isidor":
|
||||
idle_animation = "idle"
|
||||
self.change_creature( "res://scenes/creature_creation/isidor.tscn" )
|
||||
"raference":
|
||||
idle_animation = "_bip01_ca_female_idle"
|
||||
self.change_creature( "res://scenes/creature_creation/raference.tscn" )
|
||||
_:
|
||||
idle_animation = ""
|
||||
self.change_creature( "res://scenes/creature_creation/arche.tscn" )
|
||||
search_animation(self)
|
||||
animation_object.play( idle_animation )
|
||||
animation_object.connect("animation_finished", self, "_on_AnimationPlayer_animation_finished")
|
||||
update_blend_shapes($creature)
|
||||
|
||||
|
||||
|
|
|
@ -13,14 +13,15 @@ size_flags_horizontal = 1
|
|||
size_flags_vertical = 1
|
||||
|
||||
[node name="camera" type="Camera" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -1.57491, 1.49725, 3 )
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.788782, 0.844113, 3 )
|
||||
projection = 1
|
||||
current = true
|
||||
size = 4.0
|
||||
size = 2.0
|
||||
|
||||
[node name="directional_light" type="DirectionalLight" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.20866, 2.21448 )
|
||||
light_energy = 2.0
|
||||
|
||||
[node name="creature" parent="." instance=ExtResource( 2 )]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.598772 )
|
||||
script = ExtResource( 3 )
|
||||
|
|
|
@ -5,27 +5,39 @@ signal select_race(race)
|
|||
signal update_blend(name_property, value)
|
||||
|
||||
var rng = RandomNumberGenerator.new()
|
||||
var current_race = "arche"
|
||||
var current_race = "raference"
|
||||
|
||||
const syllabe = ["ba", "be", "bi", "bo", "bu", "bou",
|
||||
"ca", "ce", "ci", "co", "cu", "cou",
|
||||
"da", "de", "di", "do", "du", "dou",
|
||||
"fa", "fe", "fi", "fo", "fu", "fou",
|
||||
"ga", "ge", "gi", "go", "gu", "gou",
|
||||
"ha", "he", "hi", "ho", "hu", "hou",
|
||||
"ja", "je", "ji", "jo", "ju", "jou",
|
||||
"ka", "ke", "ki", "ko", "ku", "kou",
|
||||
"la", "le", "li", "lo", "lu", "lou",
|
||||
"ma", "me", "mi", "mo", "mu", "mou",
|
||||
"na", "ne", "ni", "no", "nu", "nou",
|
||||
"ma", "me", "mi", "mo", "mu", "mou",
|
||||
"pa", "pe", "pi", "po", "pu", "pou",
|
||||
"ra", "re", "ri", "ro", "ru", "rou",
|
||||
"sa", "se", "si", "so", "su", "sou",
|
||||
"ta", "te", "ti", "to", "tu", "tou",
|
||||
"va", "ve", "vi", "vo", "vu", "vou"
|
||||
const syllabe = ["ba", "be", "bi", "bo", "bu", "bou", "by",
|
||||
"ca", "ce", "ci", "co", "cu", "cou", "cy",
|
||||
"da", "de", "di", "do", "du", "dou", "dy",
|
||||
"fa", "fe", "fi", "fo", "fu", "fou", "fy",
|
||||
"ga", "ge", "gi", "go", "gu", "gou", "gy",
|
||||
"ha", "he", "hi", "ho", "hu", "hou", "hy",
|
||||
"ja", "je", "ji", "jo", "ju", "jou", "jy",
|
||||
"ka", "ke", "ki", "ko", "ku", "kou", "ky",
|
||||
"la", "le", "li", "lo", "lu", "lou", "ly",
|
||||
"ma", "me", "mi", "mo", "mu", "mou", "my",
|
||||
"na", "ne", "ni", "no", "nu", "nou", "ny",
|
||||
"pa", "pe", "pi", "po", "pu", "pou", "py",
|
||||
"qa", "qe", "qi", "qo", "qu", "qou", "qy",
|
||||
"ra", "re", "ri", "ro", "ru", "rou", "sy",
|
||||
"sa", "se", "si", "so", "su", "sou", "sy",
|
||||
"ta", "te", "ti", "to", "tu", "tou", "ty",
|
||||
"va", "ve", "vi", "vo", "vu", "vou", "vy",
|
||||
"wa", "we", "wi", "wo", "wu", "wou", "wy",
|
||||
"xa", "xe", "xi", "xo", "xu", "xou", "xy",
|
||||
"za", "ze", "zi", "zo", "zu", "zou", "zy"
|
||||
]
|
||||
|
||||
const arche_begin = []
|
||||
const arche_end = ["par", "tar", "lar", "nar", "var", "xar", "rar", "sar"]
|
||||
|
||||
const isidor_begin = []
|
||||
const isidor_end = ["por", "tor", "lor", "nor"]
|
||||
|
||||
const raference_begin = []
|
||||
const raference_end = ["rat", "rap", "ral", "ran"]
|
||||
|
||||
func _ready():
|
||||
rng.randomize()
|
||||
$create/diplay/panel_left/margin/property.hide()
|
||||
|
@ -43,6 +55,11 @@ func _on_isidor_pressed():
|
|||
emit_signal("select_race", current_race)
|
||||
|
||||
|
||||
func _on_raference_pressed():
|
||||
current_race = "raference"
|
||||
emit_signal("select_race", current_race)
|
||||
|
||||
|
||||
func _on_quit_pressed():
|
||||
Config.msg_debug("Quit")
|
||||
# emit_signal( "quit_pressed" )
|
||||
|
@ -81,6 +98,15 @@ func _on_property_next_pressed():
|
|||
for pop in key.get_children():
|
||||
if pop is HBoxContainer:
|
||||
Config.msg_debug( str(pop.name_property) + ": " + str(pop.get_node("property").value) )
|
||||
Globals.player['FirstName'] = $create/diplay/panel_left/margin/name/v_box_container/FirstName/line_edit.text
|
||||
Globals.player['LastName'] = $create/diplay/panel_left/margin/name/v_box_container/LastName/line_edit.text
|
||||
Globals.player['Race'] = current_race
|
||||
Globals.player['blend_shape'] = {}
|
||||
for key in $create/diplay/panel_left/margin/property/panel/blend_shape/list.get_children():
|
||||
for pop in key.get_children():
|
||||
if pop is HBoxContainer:
|
||||
Globals.player['blend_shape'][ str(pop.name_property) ] = pop.get_node("property").value
|
||||
Globals.goto_scene("res://scenes/game/alpha.tscn")
|
||||
|
||||
|
||||
func generate_name_key(minsyllabe:int, maxsyllabe:int, start:Array = [], end:Array = []) -> String:
|
||||
|
@ -100,10 +126,13 @@ func generate_name():
|
|||
var last_name: String = ""
|
||||
match current_race:
|
||||
"arche":
|
||||
first_name = generate_name_key(1, 3, [], ["par", "tar", "lar", "nar", "var", "xar", "rar", "sar"])
|
||||
first_name = generate_name_key(1, 3, arche_begin, arche_end)
|
||||
last_name = generate_name_key(2, 5)
|
||||
"isidor":
|
||||
first_name = generate_name_key(1, 3, [], ["por", "tor", "lor", "nor"])
|
||||
first_name = generate_name_key(1, 3, isidor_begin, isidor_end)
|
||||
last_name = generate_name_key(2, 5)
|
||||
"raference":
|
||||
first_name = generate_name_key(1, 3, raference_begin, raference_end)
|
||||
last_name = generate_name_key(2, 5)
|
||||
_:
|
||||
first_name = "paf"
|
||||
|
|
|
@ -63,7 +63,6 @@ __meta__ = {
|
|||
}
|
||||
|
||||
[node name="race" type="VBoxContainer" parent="create/diplay/panel_left/margin"]
|
||||
visible = false
|
||||
margin_left = 50.0
|
||||
margin_top = 50.0
|
||||
margin_right = 538.0
|
||||
|
@ -71,7 +70,7 @@ margin_bottom = 570.0
|
|||
|
||||
[node name="creature_creation" type="VBoxContainer" parent="create/diplay/panel_left/margin/race"]
|
||||
margin_right = 488.0
|
||||
margin_bottom = 106.0
|
||||
margin_bottom = 152.0
|
||||
|
||||
[node name="label" type="Label" parent="create/diplay/panel_left/margin/race/creature_creation"]
|
||||
margin_right = 488.0
|
||||
|
@ -109,6 +108,17 @@ margin_right = 488.0
|
|||
margin_bottom = 106.0
|
||||
text = "Isidor"
|
||||
|
||||
[node name="label_4" type="Label" parent="create/diplay/panel_left/margin/race/creature_creation"]
|
||||
margin_top = 110.0
|
||||
margin_right = 488.0
|
||||
margin_bottom = 124.0
|
||||
|
||||
[node name="raference" type="Button" parent="create/diplay/panel_left/margin/race/creature_creation"]
|
||||
margin_top = 128.0
|
||||
margin_right = 488.0
|
||||
margin_bottom = 152.0
|
||||
text = "Raference"
|
||||
|
||||
[node name="h_box_container" type="HBoxContainer" parent="create/diplay/panel_left/margin/race"]
|
||||
margin_top = 488.0
|
||||
margin_right = 488.0
|
||||
|
@ -129,6 +139,7 @@ size_flags_horizontal = 10
|
|||
texture_normal = ExtResource( 3 )
|
||||
|
||||
[node name="name" type="VBoxContainer" parent="create/diplay/panel_left/margin"]
|
||||
visible = false
|
||||
margin_left = 50.0
|
||||
margin_top = 50.0
|
||||
margin_right = 538.0
|
||||
|
@ -210,6 +221,7 @@ size_flags_horizontal = 10
|
|||
texture_normal = ExtResource( 3 )
|
||||
|
||||
[node name="property" type="VBoxContainer" parent="create/diplay/panel_left/margin"]
|
||||
visible = false
|
||||
margin_left = 50.0
|
||||
margin_top = 50.0
|
||||
margin_right = 538.0
|
||||
|
@ -277,6 +289,7 @@ size_flags_vertical = 3
|
|||
|
||||
[connection signal="pressed" from="create/diplay/panel_left/margin/race/creature_creation/arche" to="." method="_on_arche_pressed"]
|
||||
[connection signal="pressed" from="create/diplay/panel_left/margin/race/creature_creation/isidor" to="." method="_on_isidor_pressed"]
|
||||
[connection signal="pressed" from="create/diplay/panel_left/margin/race/creature_creation/raference" to="." method="_on_raference_pressed"]
|
||||
[connection signal="pressed" from="create/diplay/panel_left/margin/race/h_box_container/quit" to="." method="_on_quit_pressed"]
|
||||
[connection signal="pressed" from="create/diplay/panel_left/margin/race/h_box_container/next" to="." method="_on_race_next_pressed"]
|
||||
[connection signal="pressed" from="create/diplay/panel_left/margin/name/v_box_container/generate_name" to="." method="_on_generate_name_pressed"]
|
||||
|
|
7
scenes/creature_creation/raference.tscn
Normal file
7
scenes/creature_creation/raference.tscn
Normal file
|
@ -0,0 +1,7 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://assets/creatures/raference/raference.tscn" type="PackedScene" id=1]
|
||||
|
||||
[node name="spatial" type="Spatial"]
|
||||
|
||||
[node name="raference" parent="." instance=ExtResource( 1 )]
|
|
@ -2,38 +2,38 @@ extends Particles
|
|||
|
||||
export var rows = 64.0 setget set_rows, get_rows
|
||||
func set_rows( value ):
|
||||
rows = value
|
||||
amount = rows * rows
|
||||
update_aabb()
|
||||
if process_material:
|
||||
process_material.set_shader_param( "rows", rows )
|
||||
rows = value
|
||||
amount = rows * rows
|
||||
update_aabb()
|
||||
if process_material:
|
||||
process_material.set_shader_param( "rows", rows )
|
||||
func get_rows():
|
||||
return rows
|
||||
return rows
|
||||
|
||||
|
||||
export var spacing = 1.0 setget set_spacing, get_spacing
|
||||
func set_spacing( value ):
|
||||
spacing = value
|
||||
update_aabb()
|
||||
if process_material:
|
||||
process_material.set_shader_param( "spacing", spacing )
|
||||
spacing = value
|
||||
update_aabb()
|
||||
if process_material:
|
||||
process_material.set_shader_param( "spacing", spacing )
|
||||
func get_spacing():
|
||||
return spacing
|
||||
return spacing
|
||||
|
||||
|
||||
func update_aabb():
|
||||
var size = self.rows * self.spacing
|
||||
self.visibility_aabb = AABB( -Vector3(0.5*size, 50.0, 0.5*size), Vector3(size, 100.0, size) )
|
||||
var size = self.rows * self.spacing
|
||||
self.visibility_aabb = AABB( -Vector3(0.5*size, 50.0, 0.5*size), Vector3(size, 100.0, size) )
|
||||
|
||||
func _ready():
|
||||
self.set_rows( self.rows )
|
||||
self.set_spacing( self.spacing )
|
||||
self.set_rows( self.rows )
|
||||
self.set_spacing( self.spacing )
|
||||
|
||||
func _process( delta ):
|
||||
|
||||
var viewport = self.get_viewport()
|
||||
var camera = viewport.get_camera()
|
||||
if camera:
|
||||
var pos = camera.global_transform.origin
|
||||
pos.y = 0.0
|
||||
self.global_transform.origin = pos
|
||||
var viewport = self.get_viewport()
|
||||
var camera = viewport.get_camera()
|
||||
if camera:
|
||||
var pos = camera.global_transform.origin
|
||||
pos.y = 0.0
|
||||
self.global_transform.origin = pos
|
||||
|
|
39
scenes/game/alpha.tscn
Normal file
39
scenes/game/alpha.tscn
Normal file
|
@ -0,0 +1,39 @@
|
|||
[gd_scene load_steps=8 format=2]
|
||||
|
||||
[ext_resource path="res://scenes/game/area_1_0.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://scenes/game/area_0_0.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://scenes/game/area_1_1.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://scenes/game/area_0_1.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://scenes/player/playerA.tscn" type="PackedScene" id=5]
|
||||
[ext_resource path="res://scenes/game/area_1_2.tscn" type="PackedScene" id=6]
|
||||
[ext_resource path="res://scenes/game/area_2_2.tscn" type="PackedScene" id=7]
|
||||
|
||||
[node name="spatial" type="Spatial"]
|
||||
|
||||
[node name="player" parent="." instance=ExtResource( 5 )]
|
||||
|
||||
[node name="area_0_0" parent="." instance=ExtResource( 2 )]
|
||||
|
||||
[node name="area_0_1" parent="." instance=ExtResource( 4 )]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 10, 0, 0 )
|
||||
|
||||
[node name="area_1_0" parent="." instance=ExtResource( 1 )]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 10 )
|
||||
|
||||
[node name="area_1_1" parent="." instance=ExtResource( 3 )]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 10, 0, 10 )
|
||||
|
||||
[node name="area_1_2" parent="." instance=ExtResource( 6 )]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -9.9736, 0.0109801, -0.0108967 )
|
||||
|
||||
[node name="area_2_2" parent="." instance=ExtResource( 7 )]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -10, 0, 10 )
|
||||
|
||||
[node name="area_3_0" parent="." instance=ExtResource( 1 )]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 10, 0, -10 )
|
||||
|
||||
[node name="area_3_1" parent="." instance=ExtResource( 3 )]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -10 )
|
||||
|
||||
[node name="area_3_2" parent="." instance=ExtResource( 2 )]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -10, 0, -10 )
|
23
scenes/game/area_0_0.tscn
Normal file
23
scenes/game/area_0_0.tscn
Normal file
|
@ -0,0 +1,23 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=2]
|
||||
albedo_color = Color( 0.717647, 0.0784314, 0.0784314, 1 )
|
||||
|
||||
[sub_resource type="PlaneMesh" id=1]
|
||||
material = SubResource( 2 )
|
||||
|
||||
[sub_resource type="ConcavePolygonShape" id=3]
|
||||
data = PoolVector3Array( 1, 0, 1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0, -1, 1, 0, -1 )
|
||||
|
||||
[node name="spatial" type="Spatial"]
|
||||
|
||||
[node name="mesh_instance" type="MeshInstance" parent="."]
|
||||
transform = Transform( 5, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0 )
|
||||
mesh = SubResource( 1 )
|
||||
material/0 = null
|
||||
|
||||
[node name="static_body" type="StaticBody" parent="mesh_instance"]
|
||||
transform = Transform( 5, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0 )
|
||||
|
||||
[node name="collision_shape" type="CollisionShape" parent="mesh_instance/static_body"]
|
||||
shape = SubResource( 3 )
|
22
scenes/game/area_0_1.tscn
Normal file
22
scenes/game/area_0_1.tscn
Normal file
|
@ -0,0 +1,22 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=1]
|
||||
albedo_color = Color( 0.658824, 0.894118, 0.0745098, 1 )
|
||||
|
||||
[sub_resource type="PlaneMesh" id=2]
|
||||
material = SubResource( 1 )
|
||||
|
||||
[sub_resource type="ConcavePolygonShape" id=3]
|
||||
data = PoolVector3Array( 1, 0, 1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0, -1, 1, 0, -1 )
|
||||
|
||||
[node name="spatial" type="Spatial"]
|
||||
|
||||
[node name="mesh_instance" type="MeshInstance" parent="."]
|
||||
transform = Transform( 5, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0 )
|
||||
mesh = SubResource( 2 )
|
||||
material/0 = null
|
||||
|
||||
[node name="static_body" type="StaticBody" parent="mesh_instance"]
|
||||
|
||||
[node name="collision_shape" type="CollisionShape" parent="mesh_instance/static_body"]
|
||||
shape = SubResource( 3 )
|
22
scenes/game/area_1_0.tscn
Normal file
22
scenes/game/area_1_0.tscn
Normal file
|
@ -0,0 +1,22 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=1]
|
||||
albedo_color = Color( 0.129412, 0.270588, 0.74902, 1 )
|
||||
|
||||
[sub_resource type="PlaneMesh" id=2]
|
||||
material = SubResource( 1 )
|
||||
|
||||
[sub_resource type="ConcavePolygonShape" id=3]
|
||||
data = PoolVector3Array( 1, 0, 1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0, -1, 1, 0, -1 )
|
||||
|
||||
[node name="spatial" type="Spatial"]
|
||||
|
||||
[node name="mesh_instance" type="MeshInstance" parent="."]
|
||||
transform = Transform( 5, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0 )
|
||||
mesh = SubResource( 2 )
|
||||
material/0 = null
|
||||
|
||||
[node name="static_body" type="StaticBody" parent="mesh_instance"]
|
||||
|
||||
[node name="collision_shape" type="CollisionShape" parent="mesh_instance/static_body"]
|
||||
shape = SubResource( 3 )
|
22
scenes/game/area_1_1.tscn
Normal file
22
scenes/game/area_1_1.tscn
Normal file
|
@ -0,0 +1,22 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=1]
|
||||
albedo_color = Color( 0.741176, 0.215686, 0.745098, 1 )
|
||||
|
||||
[sub_resource type="PlaneMesh" id=2]
|
||||
material = SubResource( 1 )
|
||||
|
||||
[sub_resource type="ConcavePolygonShape" id=3]
|
||||
data = PoolVector3Array( 1, 0, 1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0, -1, 1, 0, -1 )
|
||||
|
||||
[node name="spatial" type="Spatial"]
|
||||
|
||||
[node name="mesh_instance" type="MeshInstance" parent="."]
|
||||
transform = Transform( 5, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0 )
|
||||
mesh = SubResource( 2 )
|
||||
material/0 = null
|
||||
|
||||
[node name="static_body" type="StaticBody" parent="mesh_instance"]
|
||||
|
||||
[node name="collision_shape" type="CollisionShape" parent="mesh_instance/static_body"]
|
||||
shape = SubResource( 3 )
|
22
scenes/game/area_1_2.tscn
Normal file
22
scenes/game/area_1_2.tscn
Normal file
|
@ -0,0 +1,22 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=1]
|
||||
albedo_color = Color( 0.215686, 0.745098, 0.384314, 1 )
|
||||
|
||||
[sub_resource type="PlaneMesh" id=2]
|
||||
material = SubResource( 1 )
|
||||
|
||||
[sub_resource type="ConcavePolygonShape" id=3]
|
||||
data = PoolVector3Array( 1, 0, 1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0, -1, 1, 0, -1 )
|
||||
|
||||
[node name="spatial" type="Spatial"]
|
||||
|
||||
[node name="mesh_instance" type="MeshInstance" parent="."]
|
||||
transform = Transform( 5, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0 )
|
||||
mesh = SubResource( 2 )
|
||||
material/0 = null
|
||||
|
||||
[node name="static_body" type="StaticBody" parent="mesh_instance"]
|
||||
|
||||
[node name="collision_shape" type="CollisionShape" parent="mesh_instance/static_body"]
|
||||
shape = SubResource( 3 )
|
22
scenes/game/area_2_2.tscn
Normal file
22
scenes/game/area_2_2.tscn
Normal file
|
@ -0,0 +1,22 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[sub_resource type="SpatialMaterial" id=1]
|
||||
albedo_color = Color( 0.215686, 0.682353, 0.745098, 1 )
|
||||
|
||||
[sub_resource type="PlaneMesh" id=2]
|
||||
material = SubResource( 1 )
|
||||
|
||||
[sub_resource type="ConcavePolygonShape" id=3]
|
||||
data = PoolVector3Array( 1, 0, 1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0, -1, 1, 0, -1 )
|
||||
|
||||
[node name="spatial" type="Spatial"]
|
||||
|
||||
[node name="mesh_instance" type="MeshInstance" parent="."]
|
||||
transform = Transform( 5, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0 )
|
||||
mesh = SubResource( 2 )
|
||||
material/0 = null
|
||||
|
||||
[node name="static_body" type="StaticBody" parent="mesh_instance"]
|
||||
|
||||
[node name="collision_shape" type="CollisionShape" parent="mesh_instance/static_body"]
|
||||
shape = SubResource( 3 )
|
66
scenes/game/decor.tscn
Normal file
66
scenes/game/decor.tscn
Normal file
|
@ -0,0 +1,66 @@
|
|||
[gd_scene load_steps=15 format=2]
|
||||
|
||||
[ext_resource path="res://assets/textures/Metal034.tres" type="Material" id=1]
|
||||
[ext_resource path="res://assets/textures/Grass001.tres" type="Material" id=2]
|
||||
[ext_resource path="res://assets/textures/Marble016.tres" type="Material" id=3]
|
||||
[ext_resource path="res://assets/textures/Metal031.tres" type="Material" id=4]
|
||||
[ext_resource path="res://assets/textures/Ice003.tres" type="Material" id=5]
|
||||
[ext_resource path="res://assets/textures/Ground048.tres" type="Material" id=6]
|
||||
|
||||
[sub_resource type="PlaneMesh" id=1]
|
||||
|
||||
[sub_resource type="PlaneMesh" id=2]
|
||||
|
||||
[sub_resource type="PlaneMesh" id=3]
|
||||
|
||||
[sub_resource type="PlaneMesh" id=4]
|
||||
|
||||
[sub_resource type="PlaneMesh" id=5]
|
||||
|
||||
[sub_resource type="PlaneMesh" id=6]
|
||||
|
||||
[sub_resource type="SphereMesh" id=7]
|
||||
|
||||
[sub_resource type="SphereMesh" id=8]
|
||||
|
||||
[node name="spatial" type="Spatial"]
|
||||
|
||||
[node name="Ground048" type="MeshInstance" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 0 )
|
||||
mesh = SubResource( 1 )
|
||||
material/0 = ExtResource( 6 )
|
||||
|
||||
[node name="Grass001" type="MeshInstance" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0, 0 )
|
||||
mesh = SubResource( 2 )
|
||||
material/0 = ExtResource( 2 )
|
||||
|
||||
[node name="Ice003" type="MeshInstance" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0, 2 )
|
||||
mesh = SubResource( 3 )
|
||||
material/0 = ExtResource( 5 )
|
||||
|
||||
[node name="Marble016" type="MeshInstance" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 2 )
|
||||
mesh = SubResource( 4 )
|
||||
material/0 = ExtResource( 3 )
|
||||
|
||||
[node name="Metal031" type="MeshInstance" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2 )
|
||||
mesh = SubResource( 5 )
|
||||
material/0 = ExtResource( 4 )
|
||||
|
||||
[node name="Metal034" type="MeshInstance" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, -2 )
|
||||
mesh = SubResource( 6 )
|
||||
material/0 = ExtResource( 1 )
|
||||
|
||||
[node name="Metal034-Sphere" type="MeshInstance" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 1, -2 )
|
||||
mesh = SubResource( 7 )
|
||||
material/0 = ExtResource( 1 )
|
||||
|
||||
[node name="Metal031-Sphere" type="MeshInstance" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 1, 2 )
|
||||
mesh = SubResource( 8 )
|
||||
material/0 = ExtResource( 4 )
|
|
@ -24,8 +24,8 @@ noise = SubResource( 1 )
|
|||
[sub_resource type="ShaderMaterial" id=3]
|
||||
resource_local_to_scene = true
|
||||
shader = ExtResource( 5 )
|
||||
shader_param/iTime = 101.769
|
||||
shader_param/iFrame = 5732
|
||||
shader_param/iTime = 145.69
|
||||
shader_param/iFrame = 8616
|
||||
shader_param/COVERAGE = 0.5
|
||||
shader_param/THICKNESS = 25.0
|
||||
shader_param/ABSORPTION = 1.031
|
||||
|
|
|
@ -36,8 +36,8 @@ func GenerateMap(filemap:String, longitude:int, latitude:int):
|
|||
# y => height, x => width
|
||||
for y in range(height):
|
||||
for x in range(width):
|
||||
var z = int(image.get_pixel(x,y).v * 500)
|
||||
var vert = Vector3(x, z, y)
|
||||
var z = int(image.get_pixel(x,y).v * 100)
|
||||
var vert = Vector3(x*10.0, z, y*10.0)
|
||||
Config.msg_debug("x:" + str(x) + " , y:" + str(y) + " , z:" + str(z))
|
||||
verts.append(vert)
|
||||
normals.append(vert.normalized())
|
||||
|
@ -50,13 +50,13 @@ func GenerateMap(filemap:String, longitude:int, latitude:int):
|
|||
indices.append(prevrow + x)
|
||||
indices.append(thisrow + x)
|
||||
indices.append(thisrow + x - 1)
|
||||
if y > 0:
|
||||
indices.append(prevrow + width - 1)
|
||||
indices.append(prevrow)
|
||||
indices.append(thisrow + width - 1)
|
||||
indices.append(prevrow)
|
||||
indices.append(prevrow + width)
|
||||
indices.append(thisrow + width - 1)
|
||||
# if y > 0:
|
||||
# indices.append(prevrow + width - 1)
|
||||
# indices.append(prevrow)
|
||||
# indices.append(thisrow + width - 1)
|
||||
# indices.append(prevrow)
|
||||
# indices.append(prevrow + width)
|
||||
# indices.append(thisrow + width - 1)
|
||||
prevrow = thisrow
|
||||
thisrow = point
|
||||
|
||||
|
@ -98,8 +98,8 @@ func GenerateSphere(rings:int = 50, radial_segments:int = 50, height:int = 1, ra
|
|||
# Loop over segments in ring.
|
||||
for j in range(radial_segments):
|
||||
var u = float(j) / radial_segments
|
||||
var x = sin(u * PI * 2.0)
|
||||
var z = cos(u * PI * 2.0)
|
||||
var x = sin(u * PI * 0.2)
|
||||
var z = cos(u * PI * 0.2)
|
||||
var vert = Vector3(x * radius * w, y, z * radius * w)
|
||||
verts.append(vert)
|
||||
normals.append(vert.normalized())
|
||||
|
@ -140,3 +140,133 @@ func GenerateSphere(rings:int = 50, radial_segments:int = 50, height:int = 1, ra
|
|||
# Commit to the ArrayMesh.
|
||||
ResourceSaver.save("user://sphere.tres", mesh, 32)
|
||||
Config.msg_debug("GenerateSphere => End")
|
||||
|
||||
|
||||
func generate_super_map(filemap:String, longitude:int, latitude:int):
|
||||
|
||||
Config.msg_debug("GenerateMap => Start")
|
||||
Config.msg_debug(" [" + filemap + "] longitude:" + str(longitude) + " latitude:" + str(latitude))
|
||||
var image = Image.new()
|
||||
var arr = []
|
||||
var mesh = ArrayMesh.new()
|
||||
|
||||
arr.resize(Mesh.ARRAY_MAX)
|
||||
# Set up the PoolVectorXArrays.
|
||||
var verts = PoolVector3Array()
|
||||
var uvs = PoolVector2Array()
|
||||
var normals = PoolVector3Array()
|
||||
var indices = PoolIntArray()
|
||||
|
||||
# Vertex indices.
|
||||
var thisrow = 0
|
||||
var prevrow = 0
|
||||
var point = 0
|
||||
image.load(filemap)
|
||||
var width = image.get_width()
|
||||
var height = image.get_height()
|
||||
image.lock()
|
||||
Config.msg_debug("width:" + str(width) + " , height:" + str(height))
|
||||
var lvl = image.get_pixel(0,0).v
|
||||
Config.msg_debug("level:" + str(lvl))
|
||||
Config.msg_debug("a:" + str(image.get_pixel(0,0).a))
|
||||
Config.msg_debug("r:" + str(image.get_pixel(0,0).r))
|
||||
Config.msg_debug("v:" + str(image.get_pixel(0,0).v))
|
||||
Config.msg_debug("b:" + str(image.get_pixel(0,0).b))
|
||||
var txt
|
||||
# y => height, x => width
|
||||
for y in range(height):
|
||||
for x in range(width):
|
||||
var z = int(image.get_pixel(x,y).v * 100)
|
||||
var vert = Vector3(x*10.0, z, y*10.0)
|
||||
Config.msg_debug("x:" + str(x) + " , y:" + str(y) + " , z:" + str(z))
|
||||
verts.append(vert)
|
||||
normals.append(vert.normalized())
|
||||
uvs.append(Vector2(x, y))
|
||||
point += 1
|
||||
if x > 0 and y > 0:
|
||||
indices.append(prevrow + x - 1)
|
||||
indices.append(prevrow + x)
|
||||
indices.append(thisrow + x - 1)
|
||||
indices.append(prevrow + x)
|
||||
indices.append(thisrow + x)
|
||||
indices.append(thisrow + x - 1)
|
||||
prevrow = thisrow
|
||||
thisrow = point
|
||||
|
||||
var rings:int = 50
|
||||
var radial_segments:int = 50
|
||||
var radius:int = 1
|
||||
arr[Mesh.ARRAY_VERTEX] = verts
|
||||
arr[Mesh.ARRAY_TEX_UV] = uvs
|
||||
arr[Mesh.ARRAY_NORMAL] = normals
|
||||
arr[Mesh.ARRAY_INDEX] = indices
|
||||
image.unlock()
|
||||
# Create mesh surface from mesh array.
|
||||
mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, arr) # No blendshapes or compression used.
|
||||
|
||||
# Add 2nd surface
|
||||
arr = []
|
||||
arr.resize(Mesh.ARRAY_MAX)
|
||||
# Set up the PoolVectorXArrays.
|
||||
verts = PoolVector3Array()
|
||||
uvs = PoolVector2Array()
|
||||
normals = PoolVector3Array()
|
||||
indices = PoolIntArray()
|
||||
|
||||
# Vertex indices.
|
||||
thisrow = 0
|
||||
prevrow = 0
|
||||
point = 0
|
||||
|
||||
# Loop over rings.
|
||||
for i in range(rings + 1):
|
||||
var v = float(i) / rings
|
||||
var w = sin(PI * v)
|
||||
var y = cos(PI * v)
|
||||
|
||||
# Loop over segments in ring.
|
||||
for j in range(radial_segments):
|
||||
var u = float(j) / radial_segments
|
||||
var x = sin(u * PI * 0.2)
|
||||
var z = cos(u * PI * 0.2)
|
||||
var vert = Vector3(x * radius * w, y, z * radius * w)
|
||||
verts.append(vert)
|
||||
normals.append(vert.normalized())
|
||||
uvs.append(Vector2(u, v))
|
||||
point += 1
|
||||
|
||||
# Create triangles in ring using indices.
|
||||
if i > 0 and j > 0:
|
||||
indices.append(prevrow + j - 1)
|
||||
indices.append(prevrow + j)
|
||||
indices.append(thisrow + j - 1)
|
||||
|
||||
indices.append(prevrow + j)
|
||||
indices.append(thisrow + j)
|
||||
indices.append(thisrow + j - 1)
|
||||
|
||||
if i > 0:
|
||||
indices.append(prevrow + radial_segments - 1)
|
||||
indices.append(prevrow)
|
||||
indices.append(thisrow + radial_segments - 1)
|
||||
|
||||
indices.append(prevrow)
|
||||
indices.append(prevrow + radial_segments)
|
||||
indices.append(thisrow + radial_segments - 1)
|
||||
|
||||
prevrow = thisrow
|
||||
thisrow = point
|
||||
|
||||
# Assign arrays to mesh array.
|
||||
arr[Mesh.ARRAY_VERTEX] = verts
|
||||
arr[Mesh.ARRAY_TEX_UV] = uvs
|
||||
arr[Mesh.ARRAY_NORMAL] = normals
|
||||
arr[Mesh.ARRAY_INDEX] = indices
|
||||
|
||||
# Create mesh surface from mesh array.
|
||||
mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, arr) # No blendshapes or compression used.
|
||||
|
||||
|
||||
# Commit to the ArrayMesh.
|
||||
ResourceSaver.save("res://map" + str(longitude) + "-" + str(latitude) + ".tres", mesh, 32)
|
||||
Config.msg_debug("GenerateMap => End")
|
||||
|
|
96
scenes/game/grass.tscn
Normal file
96
scenes/game/grass.tscn
Normal file
File diff suppressed because one or more lines are too long
307
scenes/game/paysage.tscn
Normal file
307
scenes/game/paysage.tscn
Normal file
File diff suppressed because one or more lines are too long
5
scenes/game/player.gd
Normal file
5
scenes/game/player.gd
Normal file
|
@ -0,0 +1,5 @@
|
|||
tool
|
||||
extends MeshInstance
|
||||
|
||||
func _process(delta) -> void:
|
||||
get_parent().get_node("multi_mesh_instance_2").material_override.set_shader_param("player_pos", global_transform.origin)
|
|
@ -15,8 +15,9 @@ func _ready():
|
|||
Connection.connect( "connection_ok", self, "_on_connexion_ok" )
|
||||
Connection.connect( "connection_error", self, "_on_connection_error" )
|
||||
#GeneratorMap.GenerateSphere()
|
||||
GeneratorMap.GenerateMap("res://ground-0-2-high.png", 0 , 1)
|
||||
#GeneratorMap.GenerateMap("res://ground-0-5-high.png", 0 , 1)
|
||||
#GeneratorMap.GenerateMap("res://ground-0-4-high.png", 0 , 0)
|
||||
#GeneratorMap.generate_super_map("res://ground-0-6-high.png", 0 , 2)
|
||||
Globals.ressource_queue.start()
|
||||
|
||||
func _process(_time):
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
[ext_resource path="res://scenes/interfaces/main_menu/main_menu.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://scenes/interfaces/loading_screen/loading_screen.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://scenes/main/main.gd" type="Script" id=3]
|
||||
[ext_resource path="res://map0-0.tres" type="ArrayMesh" id=5]
|
||||
[ext_resource path="res://map0-1.tres" type="ArrayMesh" id=4]
|
||||
|
||||
[node name="main" type="Spatial"]
|
||||
script = ExtResource( 3 )
|
||||
|
@ -19,7 +19,7 @@ visible = false
|
|||
|
||||
[node name="mesh_instance_2" type="MeshInstance" parent="."]
|
||||
visible = false
|
||||
mesh = ExtResource( 5 )
|
||||
mesh = ExtResource( 4 )
|
||||
material/0 = null
|
||||
|
||||
[connection signal="play_pressed" from="main_menu" to="." method="_on_main_menu_play_pressed"]
|
||||
|
|
166
scenes/player/playerA.gd
Normal file
166
scenes/player/playerA.gd
Normal file
|
@ -0,0 +1,166 @@
|
|||
extends Spatial
|
||||
|
||||
var animation_object:AnimationPlayer = null
|
||||
|
||||
var rotation_speed_factor = 0.01
|
||||
var move_speed = 2.5
|
||||
var run_speed = 5.0
|
||||
var max_speed = 12.0
|
||||
export var gravity = -9.0
|
||||
|
||||
var orientation = 0.0
|
||||
var direction = Vector3.ZERO
|
||||
var velocity: = Vector3.ZERO
|
||||
var idle_animation = "idle"
|
||||
|
||||
func search_animation( obj ) -> bool:
|
||||
var ret:bool = false
|
||||
for i in obj.get_children():
|
||||
if i.get_name() == "AnimationPlayer":
|
||||
animation_object = i
|
||||
return true
|
||||
else:
|
||||
ret = search_animation(i)
|
||||
if ret == true:
|
||||
return ret
|
||||
return false
|
||||
|
||||
|
||||
func _ready():
|
||||
match Globals.player['Race']:
|
||||
"arche":
|
||||
idle_animation = "idle"
|
||||
self.change_creature( "res://scenes/creature_creation/arche.tscn" )
|
||||
"isidor":
|
||||
idle_animation = "idle"
|
||||
self.change_creature( "res://scenes/creature_creation/isidor.tscn" )
|
||||
"raference":
|
||||
idle_animation = "_bip01_ca_female_idle"
|
||||
self.change_creature( "res://scenes/creature_creation/raference.tscn" )
|
||||
_:
|
||||
idle_animation = "idle"
|
||||
self.change_creature( "res://scenes/creature_creation/arche.tscn" )
|
||||
# search_animation($kinematic_body)
|
||||
# Globals.player['blend_shape']
|
||||
update_blend_shapes($kinematic_body/creature, Globals.player['blend_shape'])
|
||||
animation_object.play( idle_animation )
|
||||
animation_object.connect("animation_finished", self, "_on_AnimationPlayer_animation_finished")
|
||||
|
||||
func _on_AnimationPlayer_animation_finished(anim_name):
|
||||
Config.msg_debug("Animation finished:" + anim_name)
|
||||
animation_object.play( anim_name )
|
||||
|
||||
static func get_input_direction() -> Vector3:
|
||||
return Vector3(
|
||||
Input.get_action_strength("move_strafe_right") - Input.get_action_strength("move_strafe_left"),
|
||||
0,
|
||||
Input.get_action_strength("move_backward") - Input.get_action_strength("move_forward")
|
||||
)
|
||||
|
||||
|
||||
func calculate_velocity(
|
||||
velocity_current: Vector3,
|
||||
move_direction: Vector3,
|
||||
delta: float
|
||||
) -> Vector3:
|
||||
var velocity_new = Vector3.ZERO
|
||||
velocity_new = move_direction
|
||||
|
||||
velocity_new *= move_speed
|
||||
if velocity_new.length() > max_speed:
|
||||
velocity_new = velocity_new.normalized() * max_speed
|
||||
velocity_new.y = velocity_current.y + gravity * delta
|
||||
return velocity_new
|
||||
|
||||
|
||||
func _process( delta ):
|
||||
|
||||
#$character.direction = self.get_input_direction()
|
||||
self.rotate_y( self.rotation_speed_factor * self.orientation )
|
||||
|
||||
# var forwards: Vector3 = 1.0 * direction.z
|
||||
# var right: Vector3 = 1.0 * direction.x
|
||||
# if forwards:
|
||||
# right = Vector3.ZERO
|
||||
# var move_direction: = forwards + right
|
||||
# if move_direction.length() > 1.0:
|
||||
# move_direction = move_direction.normalized()
|
||||
# move_direction.y = 0
|
||||
# velocity = self.calculate_velocity(velocity, move_direction, delta)
|
||||
## $creature.move_and_slide(velocity, Vector3.UP, true)
|
||||
# velocity = $kinematic_body.move_and_slide(velocity, Vector3.UP, true)
|
||||
|
||||
|
||||
func _input( event ):
|
||||
# Config.msg_debug(str(event))
|
||||
self.direction = self.get_input_direction()
|
||||
if not Input.is_key_pressed( KEY_SHIFT ):
|
||||
self.orientation = (Input.get_action_strength("move_turn_left") - Input.get_action_strength("move_turn_right"))
|
||||
else:
|
||||
self.orientation = 0.0
|
||||
if event is InputEventMouseMotion and Input.is_mouse_button_pressed( 2 ):
|
||||
if $kinematic_body/creature:
|
||||
self.rotate_y( event.relative.x *0.01 )
|
||||
elif event.is_action( "camera_zoom_in" ):
|
||||
# self.zoom_level += 1
|
||||
self.move_speed
|
||||
pass
|
||||
elif event.is_action( "camera_zoom_out" ):
|
||||
# self.zoom_level -= 1
|
||||
pass
|
||||
elif event.is_action_pressed( "camera_switch" ):
|
||||
if $camera_tps.current:
|
||||
$camera_fps.make_current()
|
||||
#$character/spring_arm.rotation = Vector3.ZERO
|
||||
# self.hide()
|
||||
else:
|
||||
$camera_tps.make_current()
|
||||
# self.show()
|
||||
elif event.is_action( "move_backward" ):
|
||||
Config.msg_info( "move_backward" )
|
||||
pass
|
||||
elif event.is_action( "move_forward" ):
|
||||
Config.msg_info( "move_forward" )
|
||||
pass
|
||||
if animation_object != null:
|
||||
# Lance une animation d'attente si on ne fait rien
|
||||
if not animation_object.is_playing() and animation_object.has_animation("idle"):
|
||||
animation_object.play( idle_animation )
|
||||
|
||||
|
||||
func change_creature( new_model_path ):
|
||||
if $kinematic_body/creature:
|
||||
var old_model = $kinematic_body/creature
|
||||
$kinematic_body.remove_child( old_model )
|
||||
old_model.queue_free()
|
||||
self.animation_object = null
|
||||
var new_model = load( new_model_path )
|
||||
if new_model:
|
||||
new_model = new_model.instance()
|
||||
new_model.name = "creature"
|
||||
$kinematic_body.add_child( new_model )
|
||||
#new_model.connect( "animation_finished", self, "_on_creature_animation_finished" )
|
||||
# new_model.duplicate_meshes()
|
||||
search_animation( new_model )
|
||||
|
||||
|
||||
func _on_creature_animation_finished(anim_name):
|
||||
Config.msg_debug("anim_name:" + anim_name)
|
||||
|
||||
func update_blend_shapes( obj , param):
|
||||
#blend_shapes = {}
|
||||
update_blend_shapes_step(obj, param, "")
|
||||
pass
|
||||
|
||||
|
||||
func update_blend_shapes_step( obj, param, father = "" ):
|
||||
for i in obj.get_children():
|
||||
var root = father + str(i.name) + "."
|
||||
if i is MeshInstance:
|
||||
for key in i.get_property_list():
|
||||
if key.name.substr(0, 13) == "blend_shapes/":
|
||||
var blend = key.name.substr(13)
|
||||
if param.has(blend):
|
||||
i.set( "blend_shapes/"+blend, param[blend] )
|
||||
update_blend_shapes_step( i, param, root)
|
||||
|
28
scenes/player/playerA.tscn
Normal file
28
scenes/player/playerA.tscn
Normal file
|
@ -0,0 +1,28 @@
|
|||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://assets/creatures/arche/arche.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://scenes/player/playerA.gd" type="Script" id=2]
|
||||
[ext_resource path="res://assets/creatures/raference/raference.tscn" type="PackedScene" id=3]
|
||||
|
||||
[sub_resource type="CylinderShape" id=1]
|
||||
|
||||
[node name="player" type="Spatial"]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="kinematic_body" type="KinematicBody" parent="."]
|
||||
|
||||
[node name="creature" parent="kinematic_body" instance=ExtResource( 3 )]
|
||||
|
||||
[node name="creature_2" parent="kinematic_body" instance=ExtResource( 1 )]
|
||||
visible = false
|
||||
|
||||
[node name="area" type="Area" parent="kinematic_body"]
|
||||
|
||||
[node name="collision_shape" type="CollisionShape" parent="kinematic_body/area"]
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="camera_tps" type="Camera" parent="."]
|
||||
transform = Transform( -1, 8.74228e-08, -5.0822e-21, 8.74228e-08, 1, -8.74228e-08, -7.64274e-15, -8.74228e-08, -1, 0, 1.23455, -1.8659 )
|
||||
|
||||
[node name="camera_fps" type="Camera" parent="."]
|
||||
transform = Transform( -1, 8.74228e-08, 0, 8.74228e-08, 1, -8.74228e-08, -7.64274e-15, -8.74228e-08, -1, 0, 1.5747, 0.453716 )
|
Loading…
Reference in a new issue