Various recolorings and selection

This commit is contained in:
Mark Hoekveen
2019-10-23 19:35:33 +02:00
parent 59fb6b44cb
commit cfa66c570a
5 changed files with 40 additions and 13 deletions
+3
View File
@@ -1,6 +1,9 @@
extends Node
var naampje = "je moeder"
var creature_id = 9
func _ready():
print(naampje)
get_node("Area").connect('input_event', get_parent(), 'select_a_bitch', [creature_id])
pass
+2 -3
View File
@@ -9,9 +9,8 @@ gradient = SubResource( 1 )
[resource]
render_priority = 1
params_diffuse_mode = 2
params_specular_mode = 1
albedo_color = Color( 1, 1, 1, 0.443137 )
params_specular_mode = 4
albedo_color = Color( 0.956863, 0.0823529, 0.505882, 1 )
metallic_specular = 0.0
subsurf_scatter_enabled = true
subsurf_scatter_strength = 0.89
+20 -5
View File
@@ -1,20 +1,35 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://figure.gltf" type="PackedScene" id=1]
[ext_resource path="res://Creature.gd" type="Script" id=2]
[ext_resource path="res://Creature.tres" type="Material" id=3]
[sub_resource type="CylinderShape" id=4]
[sub_resource type="CylinderMesh" id=3]
top_radius = 0.5
bottom_radius = 0.5
height = 0.001
radial_segments = 8
rings = 2
[sub_resource type="ShaderMaterial" id=4]
[sub_resource type="CylinderShape" id=1]
height = 1.21849
[node name="Creature" instance=ExtResource( 1 )]
[node name="Creature" index="0" instance=ExtResource( 1 )]
script = ExtResource( 2 )
[node name="SelectionIndicator" type="MeshInstance" parent="." index="0"]
visible = false
cast_shadow = 0
mesh = SubResource( 3 )
material/0 = SubResource( 4 )
[node name="Mesh" parent="Node/Node 2/Armature" index="0"]
material/0 = ExtResource( 3 )
[node name="Area" type="Area" parent="." index="2"]
[node name="Area" type="Area" parent="." index="3"]
[node name="CollisionShape" type="CollisionShape" parent="Area" index="0"]
transform = Transform( 0.25, 0, 0, 0, 1, 0, 0, 0, 0.25, 0, 0.803572, 0 )
shape = SubResource( 4 )
shape = SubResource( 1 )
+12 -2
View File
@@ -1,7 +1,8 @@
extends Node
export (PackedScene) var Creature
var selected;
var selected = []
var id_counter = 0
func _ready():
pass
@@ -9,15 +10,24 @@ func _ready():
func spawn_a_bitch():
# Maak een bitch
var c = Creature.instance()
c.creature_id = id_counter
id_counter += 1
add_child(c)
# Geef de bitch een random positie en rotatie
c.rotate_y(rand_range(-5, 5))
c.transform = Transform(c.transform.basis, Vector3(rand_range(-7, 7), 0, rand_range(-5, 5)))
print_tree ( )
# print_tree ( )
func kill_a_bitch():
var c = get_child(get_child_count()-1)
if c:
c.queue_free()
#remove_child(c)
func select_a_bitch(camera, event, click_position, click_normal, index, creature_id):
if event.is_action_pressed("select_creature"):
var kindeke = get_child(creature_id)
selected.push(creature_id)
kindeke.get_node("SelectionIndicator").visible = true;
print(creature_id)
+2 -2
View File
@@ -7,7 +7,7 @@
[sub_resource type="ProceduralSky" id=2]
radiance_size = 5
sky_top_color = Color( 0.258824, 0.305882, 0.678431, 1 )
sky_top_color = Color( 0.992157, 1, 0.870588, 1 )
sky_horizon_color = Color( 0.847059, 0.411765, 0.14902, 1 )
sky_curve = 0.0783495
ground_bottom_color = Color( 0.176471, 0.243137, 0.180392, 1 )
@@ -73,7 +73,7 @@ margin_bottom = -586.0
align = 1
[node name="Camera" type="Camera" parent="."]
transform = Transform( 1, 0, 0, 0, 0.884831, 0.465913, 0, -0.465913, 0.884831, 0.29992, 5.61605, 11.1106 )
transform = Transform( 1, 0, 0, 0, 0.879275, 0.476315, 0, -0.476315, 0.879275, 0, 10.2303, 14.7057 )
[node name="CreatureLab" type="Node" parent="."]
script = ExtResource( 1 )