camera as its own scene and not part of main

This commit is contained in:
gdz
2025-12-14 00:00:08 +01:00
parent df937c69d0
commit d1758f750d
3 changed files with 35 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
extends Node2D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
if Input.is_action_pressed("MoveUp"):
global_position += Vector2.UP * 2
if Input.is_action_pressed("MoveDown"):
global_position += Vector2.DOWN * 2
if Input.is_action_pressed("MoveLeft"):
global_position += Vector2.LEFT * 2
if Input.is_action_pressed("MoveRight"):
global_position += Vector2.RIGHT * 2

View File

@@ -0,0 +1 @@
uid://brublmhrsdc7l

View File

@@ -0,0 +1,17 @@
[gd_scene load_steps=4 format=3 uid="uid://bfvijh611aggp"]
[ext_resource type="Script" uid="uid://brublmhrsdc7l" path="res://Scenes/Camera/camera_controller.gd" id="1_ig7ij"]
[ext_resource type="Script" uid="uid://xrddv2epi3ty" path="res://addons/smartcamera2D/SmartCamera2D.gd" id="2_du7i2"]
[ext_resource type="Texture2D" uid="uid://bq6ud1dmn8fds" path="res://addons/smartcamera2D/Camera2D.svg" id="3_bg4ca"]
[node name="CameraController" type="Node2D"]
script = ExtResource("1_ig7ij")
metadata/_edit_group_ = true
[node name="SmartCamera2D" type="Camera2D" parent="."]
script = ExtResource("2_du7i2")
target = NodePath("..")
metadata/_custom_type_script = "uid://xrddv2epi3ty"
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("3_bg4ca")