mirror of
https://github.com/Escada-Games/diver-down.git
synced 2026-01-23 03:24:02 +00:00
119 lines
3.5 KiB
Text
119 lines
3.5 KiB
Text
[gd_scene load_steps=10 format=2]
|
|
|
|
[ext_resource path="res://Scenes/spotlight.tscn" type="PackedScene" id=1]
|
|
[ext_resource path="res://Resources/MoreTextures/button.png" type="Texture" id=2]
|
|
[ext_resource path="res://Resources/SFX/Laser_shoot 6.wav" type="AudioStream" id=3]
|
|
[ext_resource path="res://Scenes/line2dBgOutline.gd" type="Script" id=4]
|
|
|
|
[sub_resource type="GDScript" id=1]
|
|
resource_name = "spotlight_with_button"
|
|
script/source = "extends Node2D
|
|
|
|
export (bool) var activated = true
|
|
|
|
func _ready() -> void:
|
|
if not activated:
|
|
$spotlight.set_process(false)
|
|
$spotlight.self_modulate.a=0
|
|
|
|
func _on_area_2d_body_entered(body) -> void:
|
|
if body.is_in_group('Player'):
|
|
$snd_press.play()
|
|
if $spotlight.is_processing():
|
|
$spotlight.set_process(false)
|
|
$spotlight/sprite.frame=1
|
|
$twn_spotlightfade.interpolate_property($spotlight, 'self_modulate:a', $spotlight.self_modulate.a, 0, 0.5, Tween.TRANS_QUART, Tween.EASE_IN)
|
|
$twn_spotlightfade.start()
|
|
else:
|
|
$spotlight.set_process(true)
|
|
$spotlight/sprite.frame=0
|
|
$twn_spotlightfade.interpolate_property($spotlight, 'self_modulate:a', $spotlight.self_modulate.a, 1, 0.4, Tween.TRANS_QUART, Tween.EASE_IN)
|
|
$twn_spotlightfade.start()
|
|
"
|
|
|
|
[sub_resource type="GDScript" id=2]
|
|
resource_name = "spotlight_with_button_line2d"
|
|
script/source = "tool
|
|
extends Line2D
|
|
|
|
func _ready():
|
|
# return
|
|
#self.points[0]=Vector2(0,0)
|
|
self.points[self.points.size()-1]=get_parent().get_node('button').position+get_parent().get_node('button/sprite').position
|
|
"
|
|
|
|
[sub_resource type="GDScript" id=3]
|
|
script/source = "extends Node2D
|
|
|
|
func _ready():
|
|
$area_2d/collision_polygon_2d.polygon=self.polygon
|
|
set_process(true)
|
|
|
|
func _process(delta):
|
|
for body in $area_2d.get_overlapping_bodies():
|
|
if body.is_in_group('Player'):
|
|
global.reload_stage()
|
|
"
|
|
|
|
[sub_resource type="RectangleShape2D" id=4]
|
|
extents = Vector2( 8, 3 )
|
|
|
|
[sub_resource type="RectangleShape2D" id=5]
|
|
extents = Vector2( 8, 3 )
|
|
|
|
[node name="spotlight_with_button" type="Node2D"]
|
|
position = Vector2( 8, 8 )
|
|
script = SubResource( 1 )
|
|
__meta__ = {
|
|
"_edit_horizontal_guides_": [ 61.0, 67.0 ],
|
|
"_edit_vertical_guides_": [ 48.0, 64.0 ]
|
|
}
|
|
|
|
[node name="line2dBgOutline" type="Line2D" parent="."]
|
|
points = PoolVector2Array( 0, 0, 48, 0, 48, 56 )
|
|
width = 4.0
|
|
default_color = Color( 0, 0, 0, 1 )
|
|
texture_mode = 593255583
|
|
joint_mode = 1
|
|
begin_cap_mode = 2
|
|
end_cap_mode = 2
|
|
script = ExtResource( 4 )
|
|
|
|
[node name="line_2d" type="Line2D" parent="."]
|
|
points = PoolVector2Array( 0, 0, 48, 0, 48, 56 )
|
|
width = 2.0
|
|
default_color = Color( 0.40625, 0.40625, 0.40625, 1 )
|
|
texture_mode = 593255583
|
|
joint_mode = 1
|
|
begin_cap_mode = 2
|
|
end_cap_mode = 2
|
|
script = SubResource( 2 )
|
|
|
|
[node name="twn_spotlightfade" type="Tween" parent="."]
|
|
|
|
[node name="spotlight" parent="." instance=ExtResource( 1 )]
|
|
color = Color( 0.807843, 0.678431, 0.45098, 0.6 )
|
|
script = SubResource( 3 )
|
|
|
|
[node name="button" type="Area2D" parent="."]
|
|
position = Vector2( 48, 48 )
|
|
|
|
[node name="sprite" type="Sprite" parent="button"]
|
|
position = Vector2( 0, 8 )
|
|
texture = ExtResource( 2 )
|
|
|
|
[node name="collision_shape_2d" type="CollisionShape2D" parent="button"]
|
|
position = Vector2( 0, 7 )
|
|
shape = SubResource( 4 )
|
|
|
|
[node name="static_body_2d" type="StaticBody2D" parent="button"]
|
|
position = Vector2( 0, 9 )
|
|
|
|
[node name="collision_shape_2d" type="CollisionShape2D" parent="button/static_body_2d"]
|
|
shape = SubResource( 5 )
|
|
|
|
[node name="snd_press" type="AudioStreamPlayer" parent="."]
|
|
stream = ExtResource( 3 )
|
|
bus = "sfx"
|
|
|
|
[connection signal="body_entered" from="button" to="." method="_on_area_2d_body_entered"]
|