camera as its own scene and not part of main
This commit is contained in:
17
Scenes/Camera/camera_controller.gd
Normal file
17
Scenes/Camera/camera_controller.gd
Normal 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
|
||||
1
Scenes/Camera/camera_controller.gd.uid
Normal file
1
Scenes/Camera/camera_controller.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://brublmhrsdc7l
|
||||
17
Scenes/Camera/camera_controller.tscn
Normal file
17
Scenes/Camera/camera_controller.tscn
Normal 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")
|
||||
Reference in New Issue
Block a user