[sub_resource type="ShaderMaterial" id=1] | [sub_resource type="ShaderMaterial" id=1] | ||||
resource_local_to_scene = true | resource_local_to_scene = true | ||||
shader = SubResource( 2 ) | shader = SubResource( 2 ) | ||||
shader_param/primary_color = Color( 1, 0.8, 0, 1 ) | |||||
shader_param/fade_offset = 0.15 | |||||
shader_param/primary_color = Color( 0, 0, 0, 1 ) | |||||
shader_param/fade_offset = 0.14 | |||||
[node name="Glowdot" type="Sprite"] | [node name="Glowdot" type="Sprite"] | ||||
material = SubResource( 1 ) | material = SubResource( 1 ) | ||||
texture = ExtResource( 1 ) | texture = ExtResource( 1 ) | ||||
script = ExtResource( 2 ) | script = ExtResource( 2 ) | ||||
pulse_offset = 0.1 | |||||
[node name="Pulse" type="Tween" parent="."] | [node name="Pulse" type="Tween" parent="."] | ||||
[sub_resource type="ShaderMaterial" id=1] | [sub_resource type="ShaderMaterial" id=1] | ||||
resource_local_to_scene = true | resource_local_to_scene = true | ||||
shader = ExtResource( 3 ) | shader = ExtResource( 3 ) | ||||
shader_param/primary_color = Color( 1, 0.8, 0, 1 ) | |||||
shader_param/fade_offset = 0.15 | |||||
shader_param/primary_color = Color( 0, 0, 0, 1 ) | |||||
shader_param/fade_offset = 0.14 | |||||
[sub_resource type="RectangleShape2D" id=2] | [sub_resource type="RectangleShape2D" id=2] | ||||
extents = Vector2( 24, 7 ) | extents = Vector2( 24, 7 ) | ||||
position = Vector2( 14.989, -0.323532 ) | position = Vector2( 14.989, -0.323532 ) | ||||
scale = Vector2( 0.25, 0.25 ) | scale = Vector2( 0.25, 0.25 ) | ||||
pulse_in_time = 0.2 | pulse_in_time = 0.2 | ||||
pulse_offset = 0.1 | |||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Doorway"] | [node name="CollisionShape2D" type="CollisionShape2D" parent="Doorway"] | ||||
shape = SubResource( 2 ) | shape = SubResource( 2 ) |
[ext_resource path="res://Data/Graphics/placeholder.png" type="Texture" id=2] | [ext_resource path="res://Data/Graphics/placeholder.png" type="Texture" id=2] | ||||
[ext_resource path="res://Data/Shaders/Liquid.shader" type="Shader" id=3] | [ext_resource path="res://Data/Shaders/Liquid.shader" type="Shader" id=3] | ||||
[sub_resource type="ShaderMaterial" id=7] | |||||
[sub_resource type="ShaderMaterial" id=1] | |||||
resource_local_to_scene = true | resource_local_to_scene = true | ||||
shader = ExtResource( 3 ) | shader = ExtResource( 3 ) | ||||
shader_param/sprite_scale = Vector2( 2.96, 1 ) | shader_param/sprite_scale = Vector2( 2.96, 1 ) | ||||
color = Color( 0.576471, 0.760784, 0.996078, 1 ) | color = Color( 0.576471, 0.760784, 0.996078, 1 ) | ||||
[node name="Liquid" type="Sprite"] | [node name="Liquid" type="Sprite"] | ||||
material = SubResource( 7 ) | |||||
material = SubResource( 1 ) | |||||
texture = ExtResource( 2 ) | texture = ExtResource( 2 ) | ||||
script = ExtResource( 1 ) | script = ExtResource( 1 ) | ||||
resource_local_to_scene = true | resource_local_to_scene = true | ||||
shader = SubResource( 1 ) | shader = SubResource( 1 ) | ||||
shader_param/primary_color = Color( 1, 0.8, 0, 1 ) | shader_param/primary_color = Color( 1, 0.8, 0, 1 ) | ||||
shader_param/fade_offset = 0.15 | |||||
shader_param/fade_offset = 0.14 | |||||
[sub_resource type="ShaderMaterial" id=3] | [sub_resource type="ShaderMaterial" id=3] | ||||
resource_local_to_scene = true | resource_local_to_scene = true | ||||
shader = SubResource( 1 ) | shader = SubResource( 1 ) | ||||
shader_param/primary_color = Color( 1, 0.8, 0, 1 ) | shader_param/primary_color = Color( 1, 0.8, 0, 1 ) | ||||
shader_param/fade_offset = 0.15 | |||||
shader_param/fade_offset = 0.24 | |||||
[sub_resource type="ShaderMaterial" id=4] | [sub_resource type="ShaderMaterial" id=4] | ||||
resource_local_to_scene = true | resource_local_to_scene = true | ||||
shader = SubResource( 1 ) | shader = SubResource( 1 ) | ||||
shader_param/primary_color = Color( 1, 0.8, 0, 1 ) | shader_param/primary_color = Color( 1, 0.8, 0, 1 ) | ||||
shader_param/fade_offset = 0.15 | |||||
shader_param/fade_offset = 0.34 | |||||
[sub_resource type="ShaderMaterial" id=5] | [sub_resource type="ShaderMaterial" id=5] | ||||
resource_local_to_scene = true | resource_local_to_scene = true | ||||
shader = SubResource( 1 ) | shader = SubResource( 1 ) | ||||
shader_param/primary_color = Color( 1, 0.8, 0, 1 ) | shader_param/primary_color = Color( 1, 0.8, 0, 1 ) | ||||
shader_param/fade_offset = 0.15 | |||||
shader_param/fade_offset = 0.24 | |||||
[sub_resource type="ShaderMaterial" id=6] | [sub_resource type="ShaderMaterial" id=6] | ||||
resource_local_to_scene = true | resource_local_to_scene = true | ||||
shader = SubResource( 1 ) | shader = SubResource( 1 ) | ||||
shader_param/primary_color = Color( 1, 0.8, 0, 1 ) | shader_param/primary_color = Color( 1, 0.8, 0, 1 ) | ||||
shader_param/fade_offset = 0.15 | |||||
shader_param/fade_offset = 0.34 | |||||
[node name="PulseArrow" type="Node2D"] | [node name="PulseArrow" type="Node2D"] | ||||
script = ExtResource( 1 ) | script = ExtResource( 1 ) | ||||
[node name="Dot" parent="." instance=ExtResource( 3 )] | [node name="Dot" parent="." instance=ExtResource( 3 )] | ||||
material = SubResource( 2 ) | material = SubResource( 2 ) | ||||
position = Vector2( 0, -0.698334 ) | position = Vector2( 0, -0.698334 ) | ||||
pulse_color = Color( 1, 0.8, 0, 1 ) | |||||
pulse_out = 0.75 | pulse_out = 0.75 | ||||
pulse_offset = 0.1 | |||||
[node name="Dot21" parent="." instance=ExtResource( 3 )] | [node name="Dot21" parent="." instance=ExtResource( 3 )] | ||||
material = SubResource( 3 ) | material = SubResource( 3 ) | ||||
position = Vector2( -53.772, 35.6152 ) | position = Vector2( -53.772, 35.6152 ) | ||||
pulse_color = Color( 1, 0.8, 0, 1 ) | |||||
pulse_out = 0.75 | pulse_out = 0.75 | ||||
pulse_offset = 0.35 | pulse_offset = 0.35 | ||||
[node name="Dot31" parent="." instance=ExtResource( 3 )] | [node name="Dot31" parent="." instance=ExtResource( 3 )] | ||||
material = SubResource( 4 ) | material = SubResource( 4 ) | ||||
position = Vector2( -110.337, 66.3421 ) | position = Vector2( -110.337, 66.3421 ) | ||||
pulse_color = Color( 1, 0.8, 0, 1 ) | |||||
pulse_out = 0.75 | pulse_out = 0.75 | ||||
pulse_offset = 0.6 | pulse_offset = 0.6 | ||||
[node name="Dot22" parent="." instance=ExtResource( 3 )] | [node name="Dot22" parent="." instance=ExtResource( 3 )] | ||||
material = SubResource( 5 ) | material = SubResource( 5 ) | ||||
position = Vector2( 52.3753, 35.6152 ) | position = Vector2( 52.3753, 35.6152 ) | ||||
pulse_color = Color( 1, 0.8, 0, 1 ) | |||||
pulse_out = 0.75 | pulse_out = 0.75 | ||||
pulse_offset = 0.35 | pulse_offset = 0.35 | ||||
[node name="Dot32" parent="." instance=ExtResource( 3 )] | [node name="Dot32" parent="." instance=ExtResource( 3 )] | ||||
material = SubResource( 6 ) | material = SubResource( 6 ) | ||||
position = Vector2( 106.147, 66.3421 ) | position = Vector2( 106.147, 66.3421 ) | ||||
pulse_color = Color( 1, 0.8, 0, 1 ) | |||||
pulse_out = 0.75 | pulse_out = 0.75 | ||||
pulse_offset = 0.6 | pulse_offset = 0.6 |
angle_random = 0.25 | angle_random = 0.25 | ||||
scale = 1.5 | scale = 1.5 | ||||
scale_random = 0.5 | scale_random = 0.5 | ||||
color = Color( 0.980392, 0.980392, 0.74902, 1 ) | |||||
[sub_resource type="RectangleShape2D" id=2] | [sub_resource type="RectangleShape2D" id=2] | ||||
extents = Vector2( 40, 40 ) | extents = Vector2( 40, 40 ) | ||||
[node name="Pusher" type="Node2D"] | [node name="Pusher" type="Node2D"] | ||||
script = ExtResource( 1 ) | script = ExtResource( 1 ) | ||||
[node name="PulseArrow1" parent="." instance=ExtResource( 2 )] | |||||
[node name="Body" type="Position2D" parent="."] | |||||
[node name="PulseArrow1" parent="Body" instance=ExtResource( 2 )] | |||||
position = Vector2( -18, -18.0497 ) | position = Vector2( -18, -18.0497 ) | ||||
scale = Vector2( 0.1, 0.1 ) | scale = Vector2( 0.1, 0.1 ) | ||||
pulse_color = Color( 0.356863, 0.960784, 0.211765, 1 ) | |||||
pulse_color = Color( 1, 1, 1, 1 ) | |||||
[node name="PulseArrow2" parent="." instance=ExtResource( 2 )] | |||||
[node name="PulseArrow2" parent="Body" instance=ExtResource( 2 )] | |||||
position = Vector2( -18, -4.04972 ) | position = Vector2( -18, -4.04972 ) | ||||
scale = Vector2( 0.1, 0.1 ) | scale = Vector2( 0.1, 0.1 ) | ||||
pulse_color = Color( 0.356863, 0.960784, 0.211765, 1 ) | |||||
pulse_color = Color( 1, 1, 1, 1 ) | |||||
[node name="PulseArrow3" parent="." instance=ExtResource( 2 )] | |||||
[node name="PulseArrow3" parent="Body" instance=ExtResource( 2 )] | |||||
position = Vector2( -18, 9.95028 ) | position = Vector2( -18, 9.95028 ) | ||||
scale = Vector2( 0.1, 0.1 ) | scale = Vector2( 0.1, 0.1 ) | ||||
pulse_color = Color( 0.356863, 0.960784, 0.211765, 1 ) | |||||
pulse_color = Color( 1, 1, 1, 1 ) | |||||
[node name="PulseArrow6" parent="." instance=ExtResource( 2 )] | |||||
[node name="PulseArrow6" parent="Body" instance=ExtResource( 2 )] | |||||
position = Vector2( 18, -18.0497 ) | position = Vector2( 18, -18.0497 ) | ||||
scale = Vector2( 0.1, 0.1 ) | scale = Vector2( 0.1, 0.1 ) | ||||
pulse_color = Color( 0.356863, 0.960784, 0.211765, 1 ) | |||||
pulse_color = Color( 1, 1, 1, 1 ) | |||||
[node name="PulseArrow5" parent="." instance=ExtResource( 2 )] | |||||
[node name="PulseArrow5" parent="Body" instance=ExtResource( 2 )] | |||||
position = Vector2( 18, -4.04972 ) | position = Vector2( 18, -4.04972 ) | ||||
scale = Vector2( 0.1, 0.1 ) | scale = Vector2( 0.1, 0.1 ) | ||||
pulse_color = Color( 0.356863, 0.960784, 0.211765, 1 ) | |||||
pulse_color = Color( 1, 1, 1, 1 ) | |||||
[node name="PulseArrow4" parent="." instance=ExtResource( 2 )] | |||||
[node name="PulseArrow4" parent="Body" instance=ExtResource( 2 )] | |||||
position = Vector2( 18, 9.95028 ) | position = Vector2( 18, 9.95028 ) | ||||
scale = Vector2( 0.1, 0.1 ) | scale = Vector2( 0.1, 0.1 ) | ||||
pulse_color = Color( 0.356863, 0.960784, 0.211765, 1 ) | |||||
pulse_color = Color( 1, 1, 1, 1 ) | |||||
[node name="Particles2D" type="Particles2D" parent="."] | |||||
[node name="Particles" type="Particles2D" parent="Body"] | |||||
position = Vector2( 0, 40.5267 ) | position = Vector2( 0, 40.5267 ) | ||||
amount = 20 | amount = 20 | ||||
process_material = SubResource( 1 ) | process_material = SubResource( 1 ) | ||||
[node name="Area2D" type="Area2D" parent="."] | |||||
[node name="Area2D" type="Area2D" parent="Body"] | |||||
visible = false | |||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] | |||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Body/Area2D"] | |||||
shape = SubResource( 2 ) | shape = SubResource( 2 ) | ||||
[connection signal="body_entered" from="Area2D" to="." method="_on_Area2D_body_entered"] | |||||
[connection signal="body_exited" from="Area2D" to="." method="_on_Area2D_body_exited"] | |||||
[connection signal="body_entered" from="Body/Area2D" to="." method="_on_Area2D_body_entered"] | |||||
[connection signal="body_exited" from="Body/Area2D" to="." method="_on_Area2D_body_exited"] |
material = SubResource( 1 ) | material = SubResource( 1 ) | ||||
position = Vector2( -127.435, 105.962 ) | position = Vector2( -127.435, 105.962 ) | ||||
scale = Vector2( 2.35979, 1.50659 ) | scale = Vector2( 2.35979, 1.50659 ) | ||||
liquid_body_color = Color( 0.517647, 0.145098, 0.145098, 1 ) | |||||
liquid_body_color = Color( 0.513726, 0.137255, 0.137255, 1 ) | |||||
liquid_surface_color = Color( 0.984314, 0.478431, 0.490196, 1 ) | liquid_surface_color = Color( 0.984314, 0.478431, 0.490196, 1 ) | ||||
[node name="Liquid" parent="." instance=ExtResource( 3 )] | [node name="Liquid" parent="." instance=ExtResource( 3 )] | ||||
[node name="Pusher" parent="." instance=ExtResource( 1 )] | [node name="Pusher" parent="." instance=ExtResource( 1 )] | ||||
position = Vector2( 108.94, -32.8218 ) | position = Vector2( 108.94, -32.8218 ) | ||||
pulse_color = Color( 0.0941176, 0.156863, 0.815686, 1 ) | |||||
pulse_color = Color( 0.980392, 0.980392, 0.74902, 1 ) | |||||
push_force = 128.0 | |||||
push_angle = 34.923 | |||||
[node name="TileMap" type="TileMap" parent="."] | [node name="TileMap" type="TileMap" parent="."] | ||||
tile_set = ExtResource( 7 ) | tile_set = ExtResource( 7 ) |
"alt": $Sprite.material.get_shader_param("rim_color") | "alt": $Sprite.material.get_shader_param("rim_color") | ||||
}; | }; | ||||
func get_rim_color(): | |||||
return $Sprite.material.get_shader_param("rim_color") | |||||
func get_tangential_acceleration(): | func get_tangential_acceleration(): | ||||
return base_tangential_accel * $Mood.get_need() | return base_tangential_accel * $Mood.get_need() | ||||
tool | |||||
extends Sprite | extends Sprite | ||||
const TRANS = Tween.TRANS_LINEAR | const TRANS = Tween.TRANS_LINEAR |
#tool | |||||
tool | |||||
extends Sprite | extends Sprite | ||||
export var liquid_body_color:Color setget _set_liquid_body_color, _get_liquid_body_color | |||||
export var liquid_surface_color:Color setget _set_liquid_surface_color, _get_liquid_surface_color | |||||
export var liquid_body_color:Color setget _set_liquid_body_color | |||||
export var liquid_surface_color:Color setget _set_liquid_surface_color | |||||
func _set_liquid_body_color(c): | func _set_liquid_body_color(c): | ||||
liquid_body_color = c | |||||
material.set_shader_param("liquid_color_main", c) | material.set_shader_param("liquid_color_main", c) | ||||
func _get_liquid_body_color(): | |||||
return material.get_shader_param("liquid_color_main") | |||||
func _set_liquid_surface_color(c): | func _set_liquid_surface_color(c): | ||||
liquid_surface_color = c | |||||
material.set_shader_param("liquid_color_surface", c) | material.set_shader_param("liquid_color_surface", c) | ||||
$Splash.process_material.color = c | $Splash.process_material.color = c | ||||
func _get_liquid_surface_color(): | |||||
return material.get_shader_param("liquid_color_surface") | |||||
func _ready(): | func _ready(): | ||||
material.set_shader_param("sprite_scale", scale) | material.set_shader_param("sprite_scale", scale) | ||||
#$Splash.process_material.color = material.get_shader_param("liquid_color_surface") | #$Splash.process_material.color = material.get_shader_param("liquid_color_surface") |
tool | |||||
extends Node2D | extends Node2D | ||||
export var pulse_color:Color = Color(1.0, 0.8, 0.0, 1.0) | |||||
export var pulse_color:Color = Color(1.0, 0.8, 0.0, 1.0) setget _set_color | |||||
func _set_color(c): | |||||
pulse_color = c | |||||
$Dot.pulse_color = c | |||||
$Dot21.pulse_color = c | |||||
$Dot22.pulse_color = c | |||||
$Dot31.pulse_color = c | |||||
$Dot32.pulse_color = c | |||||
func _ready(): | func _ready(): | ||||
set_color(pulse_color) | set_color(pulse_color) | ||||
$Dot.start() | $Dot.start() | ||||
$Dot32.start() | $Dot32.start() | ||||
func set_color(c): | func set_color(c): | ||||
pulse_color = c | |||||
$Dot.pulse_color = c | |||||
$Dot21.pulse_color = c | |||||
$Dot22.pulse_color = c | |||||
$Dot31.pulse_color = c | |||||
$Dot32.pulse_color = c | |||||
_set_color(c) | |||||
tool | |||||
extends Node2D | extends Node2D | ||||
const PUSH_VEC_DEFAULT = Vector2(0.0, -1.0) | const PUSH_VEC_DEFAULT = Vector2(0.0, -1.0) | ||||
export var pulse_color:Color = Color(1.0, 1.0, 1.0, 1.0) | |||||
export var pulse_color:Color = Color(1.0, 1.0, 1.0, 1.0) setget _set_color | |||||
export(float, 0, 400) var push_force = 128 | export(float, 0, 400) var push_force = 128 | ||||
export(float, 0, 1.0) var push_frequency = 0.2 | export(float, 0, 1.0) var push_frequency = 0.2 | ||||
export(float, -180.0, 180) var push_angle = 0 | |||||
export(float, -180.0, 180) var push_angle = 0 setget _set_angle | |||||
var _bodies = [] | var _bodies = [] | ||||
var _delay = 1.1 | var _delay = 1.1 | ||||
func _dominant_color(): | |||||
if pulse_color.r > pulse_color.g and pulse_color.r > pulse_color.b: | |||||
func _set_angle(a): | |||||
push_angle = a | |||||
$Body.rotation_degrees = push_angle | |||||
func _set_color(c): | |||||
pulse_color = c | |||||
for i in range(6): | |||||
get_node("Body/PulseArrow" + String(i + 1)).set_color(pulse_color) | |||||
$Body/Particles.process_material.color = c | |||||
func _dominant_color(c): | |||||
if c.r > c.g and c.r > c.b: | |||||
return "r" | return "r" | ||||
elif pulse_color.g > pulse_color.r and pulse_color.g > pulse_color.b: | |||||
elif c.g > c.r and c.g > c.b: | |||||
return "g" | return "g" | ||||
elif pulse_color.b > pulse_color.r and pulse_color.b > pulse_color.g: | |||||
elif c.b > c.r and c.b > c.g: | |||||
return "b" | return "b" | ||||
return "n" | return "n" | ||||
func _ready(): | func _ready(): | ||||
set_process(true) | set_process(true) | ||||
for i in range(6): | for i in range(6): | ||||
get_node("PulseArrow" + String(i + 1)).set_color(pulse_color) | |||||
get_node("Body/PulseArrow" + String(i + 1)).set_color(pulse_color) | |||||
func _mood_match(body): | |||||
if body.has_method("get_mood"): | |||||
var mood = body.get_mood() | |||||
var dc = _dominant_color() | |||||
if (dc == "r" and mood.is_aggressive()) or \ | |||||
(dc == "g" and mood.is_needie()) or \ | |||||
(dc == "b" and mood.is_content()): | |||||
func _rim_match(body): | |||||
if body.has_method("get_rim_color"): | |||||
var rdc = _dominant_color(body.get_rim_color()) | |||||
var dc = _dominant_color(pulse_color) | |||||
print ("RIM: ", rdc, " | Push: ", dc) | |||||
if (rdc == dc): | |||||
return true | return true | ||||
return false | return false | ||||
_delay = 0.0 | _delay = 0.0 | ||||
var v = PUSH_VEC_DEFAULT.rotated(deg2rad(push_angle)) | var v = PUSH_VEC_DEFAULT.rotated(deg2rad(push_angle)) | ||||
for i in range(_bodies.size()): | for i in range(_bodies.size()): | ||||
if _mood_match(_bodies[i]): | |||||
if _rim_match(_bodies[i]): | |||||
_bodies[i].apply_central_impulse(v * push_force) | _bodies[i].apply_central_impulse(v * push_force) | ||||
else: | else: | ||||
_delay = min(1.1, _delay + delta) | _delay = min(1.1, _delay + delta) |