Elevator Button reagiert auf "E"

This commit is contained in:
Jakob Feldmann 2023-03-14 16:36:27 +01:00
parent d725970539
commit 96fe70fefc
9 changed files with 75 additions and 90 deletions

View File

@ -149,6 +149,11 @@ click={
"events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":1,"pressed":false,"doubleclick":false,"script":null)
]
}
interact={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":69,"unicode":0,"echo":false,"script":null)
]
}
[layer_names]

View File

@ -39,9 +39,13 @@ func _ready():
print(screen_rect)
self.position = blobby.global_position
image.create(128, 2, false, Image.FORMAT_RGBAH)
# TODO Test Performance
_update_lighting_shader()
# TODO Trigger when needed
# get_node("LightAnimationPlayer").play("Pulsing")
signalManager.connect("terminal_activated", self, "_on_SignalManager_terminal_activated")
func _on_SignalManager_terminal_activated():
get_node("LightAnimationPlayer").play("Pulsing")
func _physics_process(delta: float) -> void:
if(!levelState.is_dead):

View File

@ -679,10 +679,10 @@ texture = ExtResource( 8 )
[node name="AnimatedSprite" type="AnimatedSprite" parent="ParallaxBackground/ParallaxLayer5"]
visible = false
frames = SubResource( 7 )
frame = 13
frame = 10
playing = true
[node name="AnimatedSprite2" type="AnimatedSprite" parent="ParallaxBackground/ParallaxLayer5"]
frames = SubResource( 8 )
frame = 4
frame = 1
playing = true

View File

@ -5,6 +5,14 @@ onready var activatorArea = $"%ActivatorArea"
onready var indicatorPlayer = $"%IndicatorPlayer"
onready var elevator = get_node("./Portal")
onready var signalManager := get_tree().root.get_child(1).get_node("%SignalManager")
onready var unactivatable_timer := $Timer
var activatable = true
func _process(delta):
if activatable && Input.is_action_just_released("interact"):
selfActivate()
signalManager.emit_signal("terminal_activated")
func selfActivate():
@ -16,8 +24,13 @@ func selfActivate():
activatorArea.set_deferred("monitoring", false)
func _on_ActivatorArea_area_entered(_area:Area2D) -> void:
selfActivate()
signalManager.emit_signal("terminal_activated")
func _on_ActivatorArea_area_entered(area:Area2D) -> void:
if area.is_in_group("player"):
activatable = true
func _on_ActivatorArea_area_exited(area:Area2D) -> void:
if area.is_in_group("player"):
unactivatable_timer.start()
func _on_Timer_timeout():
activatable = false

View File

@ -1,8 +1,8 @@
[gd_scene load_steps=9 format=2]
[gd_scene load_steps=8 format=2]
[ext_resource path="res://src/Contraptions/Triggers/ElevatorButton.gd" type="Script" id=1]
[sub_resource type="StreamTexture" id=1]
[ext_resource path="res://assets/contraption/button.png" type="Texture" id=2]
[ext_resource path="res://assets/contraption/buttonStateIndicator.png" type="Texture" id=3]
[sub_resource type="Animation" id=2]
resource_name = "pushing"
@ -20,8 +20,6 @@ tracks/0/keys = {
"values": [ 0.0, 1.0, 2.0 ]
}
[sub_resource type="StreamTexture" id=17]
[sub_resource type="Animation" id=10]
length = 0.1
tracks/0/type = "value"
@ -53,18 +51,15 @@ tracks/0/keys = {
"values": [ 7.0, 8.0, 6.0, 4.0 ]
}
[sub_resource type="RectangleShape2D" id=4]
extents = Vector2( 4, 1 )
[sub_resource type="RectangleShape2D" id=3]
extents = Vector2( 6, 1 )
[sub_resource type="CircleShape2D" id=18]
radius = 18.0
[node name="Terminal" type="Node2D"]
script = ExtResource( 1 )
[node name="Button" type="Sprite" parent="."]
position = Vector2( 0, -6 )
texture = SubResource( 1 )
texture = ExtResource( 2 )
hframes = 2
vframes = 2
__meta__ = {
@ -78,7 +73,7 @@ anims/pushing = SubResource( 2 )
[node name="Indicator" type="Sprite" parent="."]
position = Vector2( 0, -1 )
z_index = 1
texture = SubResource( 17 )
texture = ExtResource( 3 )
hframes = 3
vframes = 3
__meta__ = {
@ -98,15 +93,11 @@ collision_layer = 24
[node name="ActivatorAreaShape" type="CollisionShape2D" parent="ActivatorArea"]
unique_name_in_owner = true
position = Vector2( 0, 3 )
shape = SubResource( 4 )
shape = SubResource( 18 )
[node name="ButtonBody" type="StaticBody2D" parent="."]
unique_name_in_owner = true
position = Vector2( 0, -6 )
collision_layer = 64
[node name="CollisionShape2D" type="CollisionShape2D" parent="ButtonBody"]
position = Vector2( 0, 5 )
shape = SubResource( 3 )
[node name="Timer" type="Timer" parent="."]
wait_time = 0.1
one_shot = true
[connection signal="area_entered" from="ActivatorArea" to="." method="_on_ActivatorArea_area_entered"]
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]

File diff suppressed because one or more lines are too long

View File

@ -87,10 +87,10 @@ wait_time = 20.0
[node name="BlobbyCam" parent="." instance=ExtResource( 12 )]
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
frame = 8
frame = 12
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
frame = 13
frame = 3
[node name="Blobby" parent="." instance=ExtResource( 2 )]
unique_name_in_owner = true

View File

@ -27,6 +27,7 @@ func start_timer():
timer.visible = true
$HUDOverlay/GetBackTimer/Timer.start()
$HUDOverlay/GetBackTimer/AnimationPlayer.play("Redlight")
_zoom_timer()
@ -52,3 +53,7 @@ func update_interface() -> void:
func _on_SignalManager_terminal_activated() -> void:
start_timer()
func _on_Timer_timeout():
pass # Replace with function body.

View File

@ -20,7 +20,7 @@ tracks/0/keys = {
[sub_resource type="Animation" id=2]
resource_name = "Redlight"
length = 2.0
length = 3.33
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("..:color")
@ -29,10 +29,10 @@ tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 1 ),
"times": PoolRealArray( 0, 1.65 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ Color( 0.423529, 0, 0, 0.160784 ), Color( 0, 0, 0, 0 ) ]
"values": [ Color( 0, 0, 0, 0 ), Color( 0.423529, 0, 0, 0.160784 ) ]
}
[node name="HUD" type="Control"]