Reworked Camera controls outside scene

feature/fight_system
kziolkowski 6 months ago
parent ab2cf3f497
commit 9c7ae20c18

@ -2122,10 +2122,6 @@ texture = ExtResource("816_1a3c1")
region_enabled = true
region_rect = Rect2(-1, 1128, 417, 299)
[node name="Camera2D" type="Camera2D" parent="CharacterBody2D"]
position = Vector2(26, -469)
zoom = Vector2(0.3, 0.3)
[node name="WateringCanUI" type="Node2D" parent="CharacterBody2D" node_paths=PackedStringArray("_stages")]
position = Vector2(0, -929)
scale = Vector2(2, 2)
@ -2171,7 +2167,7 @@ texture = ExtResource("473_g32y8")
script = ExtResource("817_6nrw3")
_fieldPrefab = ExtResource("818_16w6h")
_movingPlayer = NodePath("../CharacterBody2D")
_camera = NodePath("../CharacterBody2D/Camera2D")
_camera = NodePath("")
_wateringParticles = NodePath("../pouring water vfx")
_wateringCanParticlesVerticalOffset = -100.0

@ -1,8 +1,9 @@
[gd_scene load_steps=84 format=3 uid="uid://gigb28qk8t12"]
[gd_scene load_steps=85 format=3 uid="uid://gigb28qk8t12"]
[ext_resource type="PackedScene" uid="uid://c25udixd5m6l0" path="res://prefabs/characters/Player2D.tscn" id="1_7wfwe"]
[ext_resource type="Texture2D" uid="uid://8sr11ex30n0m" path="res://art/mockups/Kenney_Backgrounds/Samples/uncolored_hills.png" id="2_7b2ri"]
[ext_resource type="PackedScene" uid="uid://bm21nqepnwaik" path="res://scenes/IndoorTest2.tscn" id="2_taxvr"]
[ext_resource type="Script" uid="uid://bqomwxclsbhd3" path="res://scripts/CSharp/Common/Camera/CameraController.cs" id="3_p4qqi"]
[ext_resource type="Texture2D" uid="uid://be1nofeo7an0" path="res://art/mockups/Kenney_Backgrounds/PNG/cloud2.png" id="3_r34wi"]
[ext_resource type="Texture2D" uid="uid://o6vnf7n7qp8o" path="res://art/mockups/Kenney_Backgrounds/PNG/cloud6.png" id="4_xh22q"]
[ext_resource type="Texture2D" uid="uid://cc0o84q5u437k" path="res://art/mockups/Kenney_Backgrounds/PNG/cloud7.png" id="5_k3wpj"]
@ -206,6 +207,19 @@ stream_2/stream = ExtResource("49_d77e7")
script = ExtResource("34_e5b7x")
_sceneToLoad = ExtResource("2_taxvr")
[node name="Camera2D" type="Camera2D" parent="." node_paths=PackedStringArray("_followNode")]
position = Vector2(3180, 1961)
scale = Vector2(1, 0.993819)
offset = Vector2(0, -500)
zoom = Vector2(0.25, 0.25)
limit_left = -6000
limit_top = -800
limit_right = 16000
limit_bottom = 4700
editor_draw_limits = true
script = ExtResource("3_p4qqi")
_followNode = NodePath("../YSorted/Vesna/CharacterBody2D")
[node name="ParallaxBackground" type="ParallaxBackground" parent="."]
[node name="background color layer" type="ParallaxLayer" parent="ParallaxBackground"]

@ -4,13 +4,10 @@ namespace Babushka.scripts.CSharp.Common.Camera;
public partial class CameraController : Camera2D
{
[Export] private float _multiplier = 1.0f;
[Export] private Node2D _followNode;
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
this.Position = _followNode.Transform.Origin * _multiplier;
this.GlobalPosition = _followNode.GlobalPosition;
}
}
Loading…
Cancel
Save