diff --git a/BoundingBoxes/CameraBounds.cs b/BoundingBoxes/CameraBounds.cs index 2c3117b..9a3ecc3 100644 --- a/BoundingBoxes/CameraBounds.cs +++ b/BoundingBoxes/CameraBounds.cs @@ -2,26 +2,36 @@ using Godot; namespace SupaLidlGame.BoundingBoxes; -public partial class CameraBounds : Node +public partial class CameraBounds : Node2D { [Export] public Area2D Trigger { get; set; } + //[Export] + //public Rect2I Bounds { get; set; } + [Export] - public RectangleShape2D Bounds { get; set; } + public Marker2D TopLeft { get; set; } + + [Export] + public Marker2D BottomRight { get; set; } public override void _Ready() { Trigger.BodyEntered += OnBodyEntered; Trigger.BodyExited += OnBodyExited; - base._Ready(); } private void OnBodyEntered(Node2D body) { + GD.Print("body entered " + body.Name); if (body is Characters.Player player) { var camera = player.Camera; + var rect = new Rect2I(); + rect.Position = (Vector2I)TopLeft.GlobalPosition; + rect.End = (Vector2I)BottomRight.GlobalPosition; + camera.SetCameraBounds(rect); } } @@ -30,7 +40,10 @@ public partial class CameraBounds : Node if (body is Characters.Player player) { var camera = player.Camera; - camera.LimitLeft = -1024; + camera.LimitLeft = int.MinValue; + camera.LimitTop = int.MinValue; + camera.LimitRight = int.MaxValue; + camera.LimitBottom = int.MaxValue; } } } diff --git a/BoundingBoxes/CameraBounds.tscn b/BoundingBoxes/CameraBounds.tscn new file mode 100644 index 0000000..18d9bd1 --- /dev/null +++ b/BoundingBoxes/CameraBounds.tscn @@ -0,0 +1,26 @@ +[gd_scene load_steps=3 format=3 uid="uid://malbos18dh7l"] + +[ext_resource type="Script" path="res://BoundingBoxes/CameraBounds.cs" id="1_vaknk"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_b2lli"] +size = Vector2(256, 272) + +[node name="CameraBounds" type="Node2D" node_paths=PackedStringArray("Trigger")] +position = Vector2(0, -89) +script = ExtResource("1_vaknk") +Trigger = NodePath("Area2D") + +[node name="Area2D" type="Area2D" parent="."] +collision_layer = 0 +collision_mask = 4 +monitorable = false + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] +shape = SubResource("RectangleShape2D_b2lli") +debug_color = Color(0.631373, 0.345098, 1, 0.419608) + +[node name="TopLeft" type="Marker2D" parent="."] +position = Vector2(-256, -40) + +[node name="BottomRight" type="Marker2D" parent="."] +position = Vector2(256, 216) diff --git a/Scenes/Maps/Arena.tscn b/Scenes/Maps/Arena.tscn index 82228a1..208e0a6 100644 --- a/Scenes/Maps/Arena.tscn +++ b/Scenes/Maps/Arena.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=19 format=3 uid="uid://b2x17su05ou5w"] +[gd_scene load_steps=20 format=3 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"] @@ -9,9 +9,10 @@ [ext_resource type="Texture2D" uid="uid://d1ukste16yq6v" path="res://Assets/Sprites/Particles/player-light.png" id="7_y7j0e"] [ext_resource type="AudioStream" uid="uid://dy4qjflo1k28b" path="res://Assets/Sounds/calm-storm-ambient.mp3" id="8_wox7d"] [ext_resource type="Script" path="res://BoundingBoxes/ConnectorBox.cs" id="9_fg062"] +[ext_resource type="PackedScene" uid="uid://malbos18dh7l" path="res://BoundingBoxes/CameraBounds.tscn" id="11_j2620"] [ext_resource type="Texture2D" uid="uid://c1a7lvb4uuwfy" path="res://Assets/Sprites/Particles/circle-16.png" id="11_yjp7m"] -[sub_resource type="ShaderMaterial" id="ShaderMaterial_pl6cr"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_i4d75"] resource_local_to_scene = true shader = ExtResource("5_h8k5p") shader_parameter/color = Vector4(1, 1, 1, 1) @@ -49,17 +50,17 @@ color = Color(0.176471, 0.0901961, 0.172549, 1) color_ramp = SubResource("GradientTexture1D_gyo0n") turbulence_enabled = true -[sub_resource type="RectangleShape2D" id="RectangleShape2D_gwpea"] -size = Vector2(256, 256) - [sub_resource type="RectangleShape2D" id="RectangleShape2D_2xagi"] size = Vector2(40, 20) +[sub_resource type="RectangleShape2D" id="RectangleShape2D_iw8cv"] +size = Vector2(64, 192) + [node name="Arena" instance=ExtResource("1_ifiic")] tile_set = ExtResource("2_x0mh7") layer_0/tile_data = PackedInt32Array(-524281, 458752, 0, -524284, 458752, 0, -262152, 458752, 0, -327673, 458752, 0, -131065, 458752, 0, -65544, 458752, 0, 131064, 458752, 0, 65543, 458752, 0, 262151, 458752, 0, 327672, 458752, 0, 524280, 458752, 0, 524283, 458752, 0, 524286, 458752, 0, 458753, 458752, 0, 458756, 458752, 0, 458759, 458752, 0, -458760, 458752, 0, -458757, 458752, 0, -524287, 458752, 0, -458754, 458752, 0, -524292, 458752, 3, -589821, 458752, 2, -589822, 393216, 3, -524291, 393216, 2, -589817, 393216, 0) -layer_2/tile_data = PackedInt32Array(1376242, 262144, 2, 1441778, 196608, 3, 1376243, 131072, 2, 1441779, 131072, 1, 1376244, 131072, 2, 1441780, 131072, 1, 1376245, 131072, 2, 1441781, 196608, 1, 1376246, 131072, 2, 1441782, 196608, 1, 1376247, 131072, 2, 1441783, 131072, 1, 1376248, 131072, 2, 1441784, 131072, 1, 1376249, 131072, 2, 1441785, 131072, 1, 1376250, 327680, 2, 1441786, 0, 5, 1441787, 131072, 2, 1441788, 131072, 2, 1441789, 131072, 2, 655358, 196608, 3, 720894, 196608, 3, 786430, 196608, 3, 851966, 196608, 3, 917502, 196608, 3, 983038, 196608, 3, 1048574, 196608, 3, 1114110, 196608, 3, 1179646, 196608, 3, 1245182, 196608, 3, 1310718, 196608, 3, 1376254, 196608, 3, 1441790, 65536, 5, 1507322, 131072, 1, 1507323, 131072, 1, 1507324, 196608, 1, 1507325, 131072, 1, 1507326, 131072, 1, 1507314, 196608, 3, 1572850, 65536, 5, 1638386, 131072, 1, 1900530, 65536, 4, 1966066, 196608, 3, 2031602, 262144, 3, 2031603, 196608, 2, 2031604, 196608, 2, 2031605, 196608, 2, 2031606, 196608, 2, 2031607, 196608, 2, 2031608, 196608, 2, 2031609, 196608, 2, 1703930, 0, 4, 1769466, 131072, 3, 1835002, 131072, 3, 1900538, 131072, 3, 1966074, 131072, 3, 2031610, 327680, 3, 1703931, 196608, 2, 1703932, 196608, 2, 1703933, 196608, 2, 589822, 65536, 4, 1703934, 196608, 2, 1703935, 196608, 2, 1638400, 196608, 2, 524289, 0, 4, 589825, 131072, 3, 655361, 131072, 3, 720897, 131072, 3, 786433, 131072, 3, 851969, 131072, 3, 917505, 131072, 3, 983041, 131072, 3, 1048577, 131072, 3, 1114113, 131072, 3, 1179649, 131072, 3, 1245185, 131072, 3, 1310721, 131072, 3, 1376257, 131072, 3, 1441793, 131072, 3, 1507329, 131072, 3, 1572865, 131072, 3, 1638401, 327680, 3) -layer_3/tile_data = PackedInt32Array(-196612, 65536, 1, -131076, 65536, 1, -65540, 196608, 0, -4, 131072, 0, -196611, 65536, 1, -131075, 65536, 0, -65539, 131072, 0, -3, 196608, 0, -196610, 65536, 0, -131074, 65536, 1, -65538, 0, 0, -2, 65536, 0, -196609, 65536, 1, -131073, 65536, 1, -65537, 65536, 0, -1, 65536, 1, -458760, 0, 0, -393224, 196608, 0, -327688, 196608, 0, -262152, 0, 0, -196616, 65536, 0, -131080, 131072, 0, -65544, 196608, 0, -8, 131072, 0, 65528, 131072, 0, 131064, 196608, 0, 196600, 131072, 0, 262136, 65536, 0, 327672, 65536, 0, 393208, 65536, 0, 458744, 0, 0, 524280, 65536, 0, -458759, 0, 1, -393223, 131072, 0, -327687, 131072, 0, -262151, 65536, 0, -196615, 65536, 1, -131079, 131072, 0, -65543, 131072, 0, -7, 196608, 0, 65529, 196608, 0, 131065, 196608, 0, 196601, 131072, 0, 262137, 65536, 1, 327673, 0, 0, 393209, 65536, 1, 458745, 65536, 0, 524281, 65536, 1, -458758, 0, 0, -393222, 65536, 0, -327686, 0, 0, -262150, 65536, 0, -196614, 0, 0, -131078, 0, 1, -65542, 196608, 0, -6, 196608, 0, 65530, 65536, 1, 131066, 65536, 1, 196602, 65536, 1, 262138, 0, 0, 327674, 65536, 1, 393210, 65536, 0, 458746, 131072, 0, 524282, 131072, 0, -458757, 65536, 0, -393221, 65536, 1, -327685, 65536, 0, -262149, 65536, 0, -196613, 0, 1, -131077, 0, 1, -65541, 131072, 0, -5, 131072, 0, 65531, 65536, 0, 131067, 0, 1, 196603, 0, 0, 262139, 0, 1, 327675, 0, 0, 393211, 65536, 0, 458747, 131072, 0, 524283, 196608, 0, -458756, 0, 0, -393220, 0, 1, -327684, 0, 0, -262148, 0, 0, 65532, 65536, 0, 131068, 65536, 0, 196604, 65536, 1, 262140, 0, 1, 327676, 131072, 0, 393212, 196608, 0, 458748, 196608, 0, 524284, 196608, 0, -458755, 0, 1, -393219, 0, 1, -327683, 0, 1, -262147, 0, 0, 65533, 65536, 0, 131069, 65536, 1, 196605, 65536, 1, 262141, 0, 1, 327677, 196608, 0, 393213, 131072, 0, 458749, 196608, 0, 524285, 131072, 0, -458754, 65536, 1, -393218, 65536, 1, -327682, 131072, 0, -262146, 196608, 0, 65534, 0, 1, 131070, 65536, 0, 196606, 196608, 0, 262142, 131072, 0, 327678, 196608, 0, 393214, 131072, 0, 458750, 65536, 0, 524286, 0, 0, -458753, 0, 1, -393217, 0, 1, -327681, 196608, 0, -262145, 131072, 0, 65535, 0, 1, 131071, 65536, 1, 196607, 131072, 0, 262143, 196608, 0, 327679, 131072, 0, 393215, 131072, 0, 458751, 65536, 1, 524287, 0, 0, -524288, 65536, 1, -458752, 65536, 1, -393216, 196608, 0, -327680, 196608, 0, -262144, 65536, 0, -196608, 0, 1, -131072, 65536, 0, -65536, 65536, 0, 0, 65536, 0, 65536, 65536, 1, 131072, 65536, 0, 196608, 65536, 1, 262144, 65536, 0, 327680, 0, 1, 393216, 0, 0, 458752, 0, 1, -524287, 65536, 1, -458751, 0, 0, -393215, 196608, 0, -327679, 196608, 0, -262143, 0, 0, -196607, 65536, 1, -131071, 0, 1, -65535, 65536, 1, 1, 0, 0, 65537, 65536, 1, 131073, 65536, 0, 196609, 65536, 0, 262145, 65536, 1, 327681, 65536, 1, 393217, 0, 1, 458753, 65536, 1, -524286, 65536, 0, -458750, 65536, 0, -393214, 131072, 0, -327678, 196608, 0, -262142, 0, 0, -196606, 65536, 0, -131070, 196608, 0, -65534, 131072, 0, 2, 131072, 0, 65538, 196608, 0, 131074, 65536, 0, 196610, 0, 0, 262146, 0, 1, 327682, 65536, 0, 393218, 131072, 0, 458754, 131072, 0, -524285, 65536, 0, -458749, 65536, 0, -393213, 131072, 0, -327677, 196608, 0, -262141, 0, 0, -196605, 65536, 0, -131069, 131072, 0, -65533, 131072, 0, 3, 196608, 0, 65539, 196608, 0, 131075, 0, 0, 196611, 0, 1, 262147, 65536, 1, 327683, 65536, 1, 393219, 196608, 0, 458755, 196608, 0, -524284, 0, 1, -458748, 65536, 0, -393212, 65536, 0, -327676, 0, 0, -262140, 65536, 1, -196604, 0, 1, -131068, 0, 1, -65532, 0, 1, 4, 0, 0, 65540, 65536, 1, 131076, 0, 0, 196612, 65536, 0, 262148, 131072, 0, 327684, 196608, 0, 393220, 196608, 0, 458756, 196608, 0, -524283, 65536, 1, -458747, 65536, 0, -393211, 65536, 1, -327675, 0, 0, -262139, 0, 1, -196603, 0, 1, -131067, 0, 1, -65531, 65536, 1, 5, 65536, 0, 65541, 65536, 0, 131077, 65536, 0, 196613, 0, 0, 262149, 196608, 0, 327685, 196608, 0, 393221, 131072, 0, 458757, 131072, 0, -524282, 0, 1, -458746, 0, 1, -393210, 0, 0, -327674, 65536, 0, -262138, 0, 0, -196602, 0, 1, -131066, 131072, 0, -65530, 196608, 0, 6, 65536, 0, 65542, 65536, 0, 131078, 0, 0, 196614, 0, 1, 262150, 65536, 0, 327686, 65536, 1, 393222, 0, 1, 458758, 0, 1, -524281, 65536, 0, -458745, 65536, 0, -393209, 196608, 0, -327673, 196608, 0, -262137, 196608, 0, -196601, 131072, 0, -131065, 196608, 0, -65529, 131072, 0, 7, 0, 1, 65543, 65536, 1, 131079, 0, 1, 196615, 0, 0, 262151, 0, 0, 327687, 0, 1, 393223, 65536, 0, 458759, 0, 1, 655359, 65536, 0, 720895, 0, 1, 589824, 0, 0, 655360, 196608, 0, 786431, 0, 0, 851967, 0, 0, 917503, 0, 1, 983039, 196608, 0, 720896, 196608, 0, 786432, 196608, 0, 851968, 0, 1, 917504, 65536, 1, 1048575, 131072, 0, 1114111, 131072, 0, 1179647, 196608, 0, 1245183, 0, 0, 983040, 0, 0, 1048576, 65536, 0, 1114112, 131072, 0, 1179648, 65536, 0, 1310719, 65536, 1, 1376255, 0, 1, 1441791, 131072, 0, 1507327, 131072, 0, 1245184, 131072, 0, 1310720, 131072, 0, 1376256, 196608, 0, 1441792, 131072, 0, 1572858, 196608, 0, 1638394, 65536, 0, 1572859, 0, 1, 1638395, 65536, 0, 1572860, 0, 0, 1638396, 196608, 0, 1572861, 196608, 0, 1638397, 196608, 0, 1572862, 65536, 1, 1638398, 196608, 0, 1572863, 65536, 1, 1638399, 0, 0, 1507328, 0, 0, 1572864, 0, 1, 1507316, 0, 0, 1572852, 0, 1, 1638388, 131072, 0, 1703924, 196608, 0, 1769460, 131072, 0, 1834996, 65536, 0, 1900532, 65536, 0, 1966068, 65536, 1, 1507317, 65536, 1, 1572853, 65536, 1, 1638389, 196608, 0, 1703925, 131072, 0, 1769461, 131072, 0, 1834997, 0, 0, 1900533, 0, 1, 1966069, 65536, 1, 1507318, 0, 1, 1572854, 0, 0, 1638390, 196608, 0, 1703926, 196608, 0, 1769462, 131072, 0, 1834998, 65536, 0, 1900534, 0, 0, 1966070, 65536, 1, 1507319, 0, 0, 1572855, 0, 0, 1638391, 196608, 0, 1703927, 196608, 0, 1769463, 196608, 0, 1834999, 65536, 0, 1900535, 65536, 1, 1966071, 65536, 0, 1507320, 65536, 1, 1572856, 0, 0, 1638392, 0, 0, 1703928, 65536, 1, 1769464, 65536, 1, 1835000, 0, 0, 1900536, 0, 1, 1966072, 65536, 1, 1507321, 0, 1, 1572857, 0, 0, 1638393, 0, 1, 1703929, 65536, 1, 1769465, 0, 1, 1835001, 65536, 1, 1900537, 0, 0, 1966073, 0, 1, 589823, 0, 0, 524288, 0, 0, 1507315, 65536, 0, 1572851, 65536, 0, 1638387, 0, 1, 1703923, 0, 0, 1769459, 196608, 0, 1834995, 0, 1, 1900531, 0, 0, 1966067, 0, 1) +layer_2/tile_data = PackedInt32Array(655358, 196608, 3, 720894, 196608, 3, 786430, 196608, 3, 851966, 196608, 3, 917502, 196608, 3, 983038, 196608, 3, 1048574, 196608, 3, 1114110, 196608, 3, 1179646, 196608, 3, 1245182, 196608, 3, 1310718, 196608, 3, 1376254, 196608, 3, 1441790, 196608, 3, 1507326, 196608, 3, 589822, 65536, 4, 524289, 0, 4, 589825, 131072, 3, 655361, 131072, 3, 720897, 131072, 3, 786433, 131072, 3, 851969, 131072, 3, 917505, 131072, 3, 983041, 131072, 3, 1048577, 131072, 3, 1114113, 131072, 3, 1179649, 131072, 3, 1245185, 131072, 3, 1310721, 131072, 3, 1376257, 131072, 3, 1441793, 131072, 3, 1507329, 131072, 3, 1572862, 196608, 3) +layer_3/tile_data = PackedInt32Array(-196612, 65536, 1, -131076, 65536, 1, -65540, 196608, 0, -4, 131072, 0, -196611, 65536, 1, -131075, 65536, 0, -65539, 131072, 0, -3, 196608, 0, -196610, 65536, 0, -131074, 65536, 1, -65538, 0, 0, -2, 65536, 0, -196609, 65536, 1, -131073, 65536, 1, -65537, 65536, 0, -1, 65536, 1, -458760, 0, 0, -393224, 196608, 0, -327688, 196608, 0, -262152, 0, 0, -196616, 65536, 0, -131080, 131072, 0, -65544, 196608, 0, -8, 131072, 0, 65528, 131072, 0, 131064, 196608, 0, 196600, 131072, 0, 262136, 65536, 0, 327672, 65536, 0, 393208, 65536, 0, 458744, 0, 0, 524280, 65536, 0, -458759, 0, 1, -393223, 131072, 0, -327687, 131072, 0, -262151, 65536, 0, -196615, 65536, 1, -131079, 131072, 0, -65543, 131072, 0, -7, 196608, 0, 65529, 196608, 0, 131065, 196608, 0, 196601, 131072, 0, 262137, 65536, 1, 327673, 0, 0, 393209, 65536, 1, 458745, 65536, 0, 524281, 65536, 1, -458758, 0, 0, -393222, 65536, 0, -327686, 0, 0, -262150, 65536, 0, -196614, 0, 0, -131078, 0, 1, -65542, 196608, 0, -6, 196608, 0, 65530, 65536, 1, 131066, 65536, 1, 196602, 65536, 1, 262138, 0, 0, 327674, 65536, 1, 393210, 65536, 0, 458746, 131072, 0, 524282, 131072, 0, -458757, 65536, 0, -393221, 65536, 1, -327685, 65536, 0, -262149, 65536, 0, -196613, 0, 1, -131077, 0, 1, -65541, 131072, 0, -5, 131072, 0, 65531, 65536, 0, 131067, 0, 1, 196603, 0, 0, 262139, 0, 1, 327675, 0, 0, 393211, 65536, 0, 458747, 131072, 0, 524283, 196608, 0, -458756, 0, 0, -393220, 0, 1, -327684, 0, 0, -262148, 0, 0, 65532, 65536, 0, 131068, 65536, 0, 196604, 65536, 1, 262140, 0, 1, 327676, 131072, 0, 393212, 196608, 0, 458748, 196608, 0, 524284, 196608, 0, -458755, 0, 1, -393219, 0, 1, -327683, 0, 1, -262147, 0, 0, 65533, 65536, 0, 131069, 65536, 1, 196605, 65536, 1, 262141, 0, 1, 327677, 196608, 0, 393213, 131072, 0, 458749, 196608, 0, 524285, 131072, 0, -458754, 65536, 1, -393218, 65536, 1, -327682, 131072, 0, -262146, 196608, 0, 65534, 0, 1, 131070, 65536, 0, 196606, 196608, 0, 262142, 131072, 0, 327678, 196608, 0, 393214, 131072, 0, 458750, 65536, 0, 524286, 0, 0, -458753, 0, 1, -393217, 0, 1, -327681, 196608, 0, -262145, 131072, 0, 65535, 0, 1, 131071, 65536, 1, 196607, 131072, 0, 262143, 196608, 0, 327679, 131072, 0, 393215, 131072, 0, 458751, 65536, 1, 524287, 0, 0, -524288, 65536, 1, -458752, 65536, 1, -393216, 196608, 0, -327680, 196608, 0, -262144, 65536, 0, -196608, 0, 1, -131072, 65536, 0, -65536, 65536, 0, 0, 65536, 0, 65536, 65536, 1, 131072, 65536, 0, 196608, 65536, 1, 262144, 65536, 0, 327680, 0, 1, 393216, 0, 0, 458752, 0, 1, -524287, 65536, 1, -458751, 0, 0, -393215, 196608, 0, -327679, 196608, 0, -262143, 0, 0, -196607, 65536, 1, -131071, 0, 1, -65535, 65536, 1, 1, 0, 0, 65537, 65536, 1, 131073, 65536, 0, 196609, 65536, 0, 262145, 65536, 1, 327681, 65536, 1, 393217, 0, 1, 458753, 65536, 1, -524286, 65536, 0, -458750, 65536, 0, -393214, 131072, 0, -327678, 196608, 0, -262142, 0, 0, -196606, 65536, 0, -131070, 196608, 0, -65534, 131072, 0, 2, 131072, 0, 65538, 196608, 0, 131074, 65536, 0, 196610, 0, 0, 262146, 0, 1, 327682, 65536, 0, 393218, 131072, 0, 458754, 131072, 0, -524285, 65536, 0, -458749, 65536, 0, -393213, 131072, 0, -327677, 196608, 0, -262141, 0, 0, -196605, 65536, 0, -131069, 131072, 0, -65533, 131072, 0, 3, 196608, 0, 65539, 196608, 0, 131075, 0, 0, 196611, 0, 1, 262147, 65536, 1, 327683, 65536, 1, 393219, 196608, 0, 458755, 196608, 0, -524284, 0, 1, -458748, 65536, 0, -393212, 65536, 0, -327676, 0, 0, -262140, 65536, 1, -196604, 0, 1, -131068, 0, 1, -65532, 0, 1, 4, 0, 0, 65540, 65536, 1, 131076, 0, 0, 196612, 65536, 0, 262148, 131072, 0, 327684, 196608, 0, 393220, 196608, 0, 458756, 196608, 0, -524283, 65536, 1, -458747, 65536, 0, -393211, 65536, 1, -327675, 0, 0, -262139, 0, 1, -196603, 0, 1, -131067, 0, 1, -65531, 65536, 1, 5, 65536, 0, 65541, 65536, 0, 131077, 65536, 0, 196613, 0, 0, 262149, 196608, 0, 327685, 196608, 0, 393221, 131072, 0, 458757, 131072, 0, -524282, 0, 1, -458746, 0, 1, -393210, 0, 0, -327674, 65536, 0, -262138, 0, 0, -196602, 0, 1, -131066, 131072, 0, -65530, 196608, 0, 6, 65536, 0, 65542, 65536, 0, 131078, 0, 0, 196614, 0, 1, 262150, 65536, 0, 327686, 65536, 1, 393222, 0, 1, 458758, 0, 1, -524281, 65536, 0, -458745, 65536, 0, -393209, 196608, 0, -327673, 196608, 0, -262137, 196608, 0, -196601, 131072, 0, -131065, 196608, 0, -65529, 131072, 0, 7, 0, 1, 65543, 65536, 1, 131079, 0, 1, 196615, 0, 0, 262151, 0, 0, 327687, 0, 1, 393223, 65536, 0, 458759, 0, 1, 655359, 65536, 0, 720895, 0, 1, 589824, 0, 0, 655360, 196608, 0, 786431, 0, 0, 851967, 0, 0, 917503, 0, 1, 983039, 196608, 0, 720896, 196608, 0, 786432, 196608, 0, 851968, 0, 1, 917504, 65536, 1, 1048575, 131072, 0, 1114111, 131072, 0, 1179647, 196608, 0, 1245183, 0, 0, 983040, 0, 0, 1048576, 65536, 0, 1114112, 131072, 0, 1179648, 65536, 0, 1310719, 65536, 1, 1376255, 0, 1, 1441791, 131072, 0, 1507327, 131072, 0, 1245184, 131072, 0, 1310720, 131072, 0, 1376256, 196608, 0, 1441792, 131072, 0, 1572863, 65536, 1, 1507328, 0, 0, 589823, 0, 0, 524288, 0, 0) layer_4/tile_data = PackedInt32Array(-524296, 327680, 0, -589818, 262144, 0, -589817, 262144, 1, -589819, 327680, 0, -589820, 196608, 1, -589821, 327680, 1, -589822, 131072, 1, -589823, 262144, 1, -589824, 327680, 0, -524289, 131072, 1, -524290, 327680, 0, -524291, 327680, 1, -524292, 327680, 1, -524293, 327680, 0, -524294, 131072, 1, -524295, 262144, 1, -589832, 131072, 2, -589831, 131072, 2, -589830, 131072, 2, -589829, 131072, 2, -589828, 131072, 2, -589827, 131072, 2, -589826, 131072, 2, -589825, 131072, 2, -655360, 131072, 2, -655359, 131072, 2, -655358, 131072, 2, -655357, 131072, 2, -655356, 131072, 2, -655355, 131072, 2, -655354, 131072, 2, -655353, 131072, 2, -655352, 327680, 2, -589833, 262144, 2, -524297, 196608, 3, -458761, 196608, 3, -393225, 196608, 3, -327689, 196608, 3, -262153, 196608, 3, -196617, 196608, 3, -131081, 196608, 3, -65545, 196608, 3, -9, 196608, 3, 65527, 196608, 3, 131063, 196608, 3, 196599, 196608, 3, 262135, 196608, 3, 327671, 196608, 3, 393207, 196608, 3, 458743, 196608, 3, 524279, 196608, 3, 262152, 131072, 3, 327688, 131072, 3, 393224, 131072, 3, 458760, 131072, 3, 196616, 131072, 3, 131080, 131072, 3, 65544, 131072, 3, 8, 131072, 3, -65528, 131072, 3, -131064, 131072, 3, -196600, 131072, 3, -262136, 131072, 3, -589816, 131072, 3, -524280, 131072, 3, -458744, 131072, 3, -393208, 131072, 3, -327672, 131072, 3, 589816, 196608, 2, 589817, 196608, 2, 589818, 196608, 2, 589819, 196608, 2, 589820, 196608, 2, 589821, 196608, 2, 589822, 196608, 2, 524289, 196608, 2, 524290, 196608, 2, 524291, 196608, 2, 524292, 196608, 2, 524293, 196608, 2, 524294, 196608, 2, 524295, 196608, 2, 524296, 327680, 3, 589815, 262144, 3) layer_5/name = "Layer -1" ClearColor = Color(0.105882, 0.0470588, 0.117647, 1) @@ -138,7 +139,7 @@ visible = false position = Vector2(120, -112) [node name="Doc" parent="Entities" index="0" instance=ExtResource("4_ej0f3")] -material = SubResource("ShaderMaterial_pl6cr") +material = SubResource("ShaderMaterial_i4d75") [node name="PointLight2D" type="PointLight2D" parent="Entities" index="1"] position = Vector2(168, -42) @@ -164,12 +165,7 @@ lifetime = 2.5 explosiveness = 0.1 randomness = 0.2 -[node name="Area2D" type="Area2D" parent="Areas" index="0"] - -[node name="CollisionShape2D" type="CollisionShape2D" parent="Areas/Area2D" index="0"] -shape = SubResource("RectangleShape2D_gwpea") - -[node name="Entrance" type="Area2D" parent="Areas" index="1"] +[node name="Entrance" type="Area2D" parent="Areas" index="0"] position = Vector2(0, 360) collision_layer = 0 collision_mask = 4 @@ -180,5 +176,38 @@ ToConnector = "ArenaEntrance" [node name="CollisionShape2D" type="CollisionShape2D" parent="Areas/Entrance" index="0"] shape = SubResource("RectangleShape2D_2xagi") +[node name="ArenaCameraBounds" parent="Areas" index="1" node_paths=PackedStringArray("TopLeft", "BottomRight") instance=ExtResource("11_j2620")] +position = Vector2(0, -1) +TopLeft = NodePath("TopLeft") +BottomRight = NodePath("BottomRight") + +[node name="Area2D" parent="Areas/ArenaCameraBounds" index="0"] +monitoring = false + +[node name="TopLeft" parent="Areas/ArenaCameraBounds" index="1"] +position = Vector2(-256, -127) + +[node name="BottomRight" parent="Areas/ArenaCameraBounds" index="2"] +position = Vector2(256, 129) + +[node name="EntranceCameraBounds" parent="Areas" index="2" node_paths=PackedStringArray("TopLeft", "BottomRight") instance=ExtResource("11_j2620")] +TopLeft = NodePath("../ArenaCameraBounds/TopLeft") +BottomRight = NodePath("BottomRight") + +[node name="Area2D" parent="Areas/EntranceCameraBounds" index="0"] +position = Vector2(0, 360) + +[node name="CollisionShape2D" parent="Areas/EntranceCameraBounds/Area2D" index="0"] +shape = SubResource("RectangleShape2D_iw8cv") + +[node name="TopLeft" parent="Areas/EntranceCameraBounds" index="1"] +position = Vector2(-256, 280) + +[node name="BottomRight" parent="Areas/EntranceCameraBounds" index="2"] +position = Vector2(256, 432) + [node name="Entrance" type="Marker2D" parent="Markers" index="0"] position = Vector2(0, 335) + +[editable path="Areas/ArenaCameraBounds"] +[editable path="Areas/EntranceCameraBounds"] diff --git a/Utils/PlayerCamera.cs b/Utils/PlayerCamera.cs index 11388b6..ccca0a5 100644 --- a/Utils/PlayerCamera.cs +++ b/Utils/PlayerCamera.cs @@ -46,4 +46,21 @@ public partial class PlayerCamera : Camera2D ret.Y = (rng.Randf() - 0.5f) * intensity; return ret; } + + public void SetCameraBoundsToMap(Scenes.Map map) + { + //var bounds = map.GetUsedRect(); + //LimitLeft = bounds.Position; + + } + + public void SetCameraBounds(Rect2I rect) + { + var start = rect.Position; + var end = rect.End; + LimitLeft = start.X; + LimitTop = start.Y; + LimitRight = end.X; + LimitBottom = end.Y; + } } diff --git a/Utils/PlayerCamera.tscn b/Utils/PlayerCamera.tscn index 8b4ce31..3757264 100644 --- a/Utils/PlayerCamera.tscn +++ b/Utils/PlayerCamera.tscn @@ -5,6 +5,8 @@ [node name="Camera2D" type="Camera2D"] zoom = Vector2(2, 2) process_callback = 0 +limit_smoothed = true +position_smoothing_speed = 32.0 script = ExtResource("1_jabhk") [node name="AnimationPlayer" type="AnimationPlayer" parent="."]