Compare commits

...

1 Commits

Author SHA1 Message Date
HumanoidSandvichDispenser e554615cc0
Add proper CameraTriggers to Arena.tscn 2024-06-07 13:12:46 -07:00
2 changed files with 32 additions and 7 deletions

View File

@ -19,6 +19,21 @@ public partial class CameraTrigger : Area2D
Connect(SignalName.BodyExited, new Callable(this, nameof(OnBodyExited)));
}
public override void _EnterTree()
{
if (!Camera.Get("tween_on_load").AsBool())
{
var tween = Camera.Get("tween_resource").AsGodotObject();
double duration = tween.Get("duration").AsDouble();
// HACK: manually set this field to interrupt tween when the
// trigger enters the scene, which happens when the scene is loaded
// from the cache
Camera.SetDeferred("_has_tweened", true);
GD.Print("set tween");
}
}
private void OnBodyEntered(Node2D node)
{
Camera.Set("priority", EnablePriority);

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=26 format=4 uid="uid://b2x17su05ou5w"]
[gd_scene load_steps=27 format=4 uid="uid://b2x17su05ou5w"]
[ext_resource type="PackedScene" uid="uid://clwv2owvk6abe" path="res://Scenes/BaseMap.tscn" id="1_ifiic"]
[ext_resource type="TileSet" uid="uid://l61kbx31ug4p" path="res://Scenes/Maps/ArenaTileset.tres" id="2_x0mh7"]
@ -54,20 +54,26 @@ turbulence_enabled = true
size = Vector2(40, 20)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_iw8cv"]
size = Vector2(32, 256)
size = Vector2(32, 254)
[sub_resource type="Resource" id="Resource_jab5j"]
[sub_resource type="Resource" id="Resource_22hgm"]
script = ExtResource("12_ca3oh")
duration = 1.0
transition = 0
ease = 2
[sub_resource type="RectangleShape2D" id="RectangleShape2D_28nvi"]
size = Vector2(1024, 384)
size = Vector2(1024, 512)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_8id2f"]
size = Vector2(256, 256)
[sub_resource type="Resource" id="Resource_bv7so"]
script = ExtResource("12_ca3oh")
duration = 1.0
transition = 0
ease = 2
[sub_resource type="RectangleShape2D" id="RectangleShape2D_idjmj"]
size = Vector2(512, 384)
@ -233,6 +239,7 @@ script = ExtResource("11_0u80h")
Camera = NodePath("Node/PhantomCamera2D")
[node name="CollisionShape2D" type="CollisionShape2D" parent="Areas/Area2D" index="0"]
position = Vector2(0, -129)
shape = SubResource("RectangleShape2D_iw8cv")
debug_color = Color(0.631373, 0.345098, 1, 0.419608)
@ -241,8 +248,10 @@ debug_color = Color(0.631373, 0.345098, 1, 0.419608)
[node name="PhantomCamera2D" type="Node2D" parent="Areas/Area2D/Node" index="0"]
position = Vector2(0, 248)
script = ExtResource("11_q01ik")
follow_mode = 1
zoom = Vector2(4, 4)
tween_resource = SubResource("Resource_jab5j")
tween_resource = SubResource("Resource_22hgm")
tween_on_load = false
draw_limits = true
limit_left = -384
limit_top = -400
@ -251,7 +260,7 @@ limit_bottom = 400
limit_target = NodePath("../CollisionShape2D")
[node name="CollisionShape2D" type="CollisionShape2D" parent="Areas/Area2D/Node" index="1"]
position = Vector2(0, 192)
position = Vector2(0, 128)
shape = SubResource("RectangleShape2D_28nvi")
[node name="Area2D2" type="Area2D" parent="Areas" index="2" node_paths=PackedStringArray("Camera")]
@ -271,7 +280,8 @@ debug_color = Color(0.631373, 0.345098, 1, 0.419608)
[node name="PhantomCamera2D" type="Node2D" parent="Areas/Area2D2/Node" index="0"]
script = ExtResource("11_q01ik")
zoom = Vector2(3, 3)
tween_resource = SubResource("Resource_jab5j")
tween_resource = SubResource("Resource_bv7so")
tween_on_load = false
draw_limits = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="Areas/Area2D2/Node" index="1"]