feat: cameras
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 6s
Create tag and build when new code gets to main / Export (push) Successful in 2m9s

This commit is contained in:
2025-07-31 18:26:01 +02:00
parent 503efeb5ec
commit 797438d0fd
8 changed files with 12923 additions and 5 deletions

39
camera/camera.gd Normal file
View File

@ -0,0 +1,39 @@
extends Node2D
@onready var area_2d: Area2D = $Area2D
@onready var camera: Camera2D = $Camera2D
@export var should_follow_player = false
@export var minimum_location = 0
@export var maximum_location = 640
var is_player_in_range = false
var player: 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 not should_follow_player or not is_player_in_range:
return
if player.global_position.x < minimum_location or player.global_position.x > maximum_location:
return
global_position.x = player.global_position.x
func _on_body_entered(body: Node2D) -> void:
if body.name == "Player":
camera.make_current()
player = body
is_player_in_range = true
func _on_body_exited(body: Node2D) -> void:
if body.name == "Player":
is_player_in_range = false

1
camera/camera.gd.uid Normal file
View File

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

21
ennemy/camera.tscn Normal file
View File

@ -0,0 +1,21 @@
[gd_scene load_steps=3 format=3 uid="uid://cwxv8xl0hi31i"]
[ext_resource type="Script" uid="uid://cn0crfbdlcoot" path="res://camera/camera.gd" id="1_f5lvx"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_7mycd"]
size = Vector2(630, 340)
[node name="CameraHandler" type="Node2D"]
script = ExtResource("1_f5lvx")
[node name="Area2D" type="Area2D" parent="."]
collision_layer = 0
collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
shape = SubResource("RectangleShape2D_7mycd")
[node name="Camera2D" type="Camera2D" parent="."]
[connection signal="body_entered" from="Area2D" to="." method="_on_body_entered"]
[connection signal="body_exited" from="Area2D" to="." method="_on_body_exited"]

File diff suppressed because one or more lines are too long

View File

@ -475,9 +475,11 @@ radius = 6.0
height = 26.0 height = 26.0
[node name="Player" type="CharacterBody2D"] [node name="Player" type="CharacterBody2D"]
collision_layer = 3
script = ExtResource("1_yw30f") script = ExtResource("1_yw30f")
[node name="Knight" type="AnimatedSprite2D" parent="."] [node name="Knight" type="AnimatedSprite2D" parent="."]
visible = false
position = Vector2(1, -28) position = Vector2(1, -28)
sprite_frames = SubResource("SpriteFrames_7l6ig") sprite_frames = SubResource("SpriteFrames_7l6ig")
animation = &"idle" animation = &"idle"

View File

@ -10,7 +10,7 @@ config_version=5
[application] [application]
config/name="ExampleProject" config/name="GMTK25"
run/main_scene="uid://s1cx1gvt4bed" run/main_scene="uid://s1cx1gvt4bed"
config/features=PackedStringArray("4.4", "Forward Plus") config/features=PackedStringArray("4.4", "Forward Plus")
config/icon="res://icon.svg" config/icon="res://icon.svg"

12331
world_assets/Cave/cave.tres Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,503 @@
[gd_resource type="TileSet" load_steps=9 format=3 uid="uid://dd5m4np46tpwj"]
[ext_resource type="Texture2D" uid="uid://bpxb7i01132fx" path="res://world_assets/stringstar fields/tileset.png" id="1_43q56"]
[ext_resource type="Texture2D" uid="uid://cjo4jkl6vrlnr" path="res://world_assets/stringstar fields/background_0.png" id="2_8j40t"]
[ext_resource type="Texture2D" uid="uid://8g0cklh8u1q6" path="res://world_assets/stringstar fields/background_1.png" id="3_y3hoy"]
[ext_resource type="Texture2D" uid="uid://bs66qg0effkb5" path="res://world_assets/stringstar fields/background_2.png" id="4_t166m"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_aw6je"]
texture = ExtResource("1_43q56")
0:0/0 = 0
1:0/0 = 0
2:0/0 = 0
3:0/0 = 0
4:0/0 = 0
5:0/0 = 0
6:0/0 = 0
13:0/0 = 0
14:0/0 = 0
15:0/0 = 0
12:1/0 = 0
13:1/0 = 0
14:1/0 = 0
15:1/0 = 0
16:1/0 = 0
0:2/0 = 0
1:2/0 = 0
2:2/0 = 0
11:2/0 = 0
12:2/0 = 0
13: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-8, 8, 8, -8, 8)
2:9/0 = 0
2:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
3:9/0 = 0
3:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
4:9/0 = 0
4:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
5:9/0 = 0
5:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
6:9/0 = 0
6:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
7:9/0 = 0
7:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
8:9/0 = 0
8:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
9:9/0 = 0
9:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
10:9/0 = 0
10:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
11:9/0 = 0
11:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
12:9/0 = 0
12:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
13:9/0 = 0
13:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
14:9/0 = 0
14:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
15:9/0 = 0
15:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
16:9/0 = 0
16:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
17:9/0 = 0
17:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
0:10/0 = 0
0:10/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
1:10/0 = 0
1:10/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
2:10/0 = 0
2:10/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
3:10/0 = 0
3:10/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
4:10/0 = 0
4:10/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
5:10/0 = 0
5:10/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
6:10/0 = 0
6:10/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
7:10/0 = 0
7:10/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
8:10/0 = 0
8:10/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
9:10/0 = 0
9:10/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_dcg8p"]
texture = ExtResource("2_8j40t")
0:0/0 = 0
1:0/0 = 0
2:0/0 = 0
3:0/0 = 0
4:0/0 = 0
5:0/0 = 0
6:0/0 = 0
7:0/0 = 0
8:0/0 = 0
9:0/0 = 0
10:0/0 = 0
11:0/0 = 0
12:0/0 = 0
13:0/0 = 0
14:0/0 = 0
15:0/0 = 0
16:0/0 = 0
17:0/0 = 0
0:1/0 = 0
1:1/0 = 0
2:1/0 = 0
3:1/0 = 0
4:1/0 = 0
5:1/0 = 0
6:1/0 = 0
7:1/0 = 0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/0 = 0
3:7/0 = 0
4:7/0 = 0
5:7/0 = 0
6:7/0 = 0
7:7/0 = 0
8:7/0 = 0
9:7/0 = 0
10:7/0 = 0
11:7/0 = 0
12:7/0 = 0
13:7/0 = 0
14:7/0 = 0
15:7/0 = 0
16:7/0 = 0
17:7/0 = 0
0:8/0 = 0
1:8/0 = 0
2:8/0 = 0
3:8/0 = 0
4:8/0 = 0
5:8/0 = 0
6:8/0 = 0
7:8/0 = 0
8:8/0 = 0
9:8/0 = 0
10:8/0 = 0
11:8/0 = 0
12:8/0 = 0
13:8/0 = 0
14:8/0 = 0
15:8/0 = 0
16:8/0 = 0
17:8/0 = 0
0:9/0 = 0
1:9/0 = 0
2:9/0 = 0
3:9/0 = 0
4:9/0 = 0
5:9/0 = 0
6:9/0 = 0
7:9/0 = 0
8:9/0 = 0
9:9/0 = 0
10:9/0 = 0
11:9/0 = 0
12:9/0 = 0
13:9/0 = 0
14:9/0 = 0
15:9/0 = 0
16:9/0 = 0
17:9/0 = 0
0:10/0 = 0
1:10/0 = 0
2:10/0 = 0
3:10/0 = 0
4:10/0 = 0
5:10/0 = 0
6:10/0 = 0
7:10/0 = 0
8:10/0 = 0
9:10/0 = 0
10:10/0 = 0
11:10/0 = 0
12:10/0 = 0
13:10/0 = 0
14:10/0 = 0
15:10/0 = 0
16:10/0 = 0
17:10/0 = 0
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_wdk1o"]
texture = ExtResource("3_y3hoy")
0:7/0 = 0
1:7/0 = 0
2:7/0 = 0
3:7/0 = 0
4:7/0 = 0
7:7/0 = 0
8:7/0 = 0
13:7/0 = 0
14:7/0 = 0
15:7/0 = 0
16:7/0 = 0
17:7/0 = 0
0:8/0 = 0
1:8/0 = 0
2:8/0 = 0
3:8/0 = 0
4:8/0 = 0
5:8/0 = 0
6:8/0 = 0
7:8/0 = 0
8:8/0 = 0
9:8/0 = 0
10:8/0 = 0
11:8/0 = 0
12:8/0 = 0
13:8/0 = 0
14:8/0 = 0
15:8/0 = 0
16:8/0 = 0
17:8/0 = 0
0:9/0 = 0
1:9/0 = 0
2:9/0 = 0
3:9/0 = 0
4:9/0 = 0
5:9/0 = 0
6:9/0 = 0
7:9/0 = 0
8:9/0 = 0
9:9/0 = 0
10:9/0 = 0
11:9/0 = 0
12:9/0 = 0
13:9/0 = 0
14:9/0 = 0
15:9/0 = 0
16:9/0 = 0
17:9/0 = 0
0:10/0 = 0
1:10/0 = 0
2:10/0 = 0
3:10/0 = 0
4:10/0 = 0
5:10/0 = 0
6:10/0 = 0
7:10/0 = 0
8:10/0 = 0
9:10/0 = 0
10:10/0 = 0
11:10/0 = 0
12:10/0 = 0
13:10/0 = 0
14:10/0 = 0
15:10/0 = 0
16:10/0 = 0
17:10/0 = 0
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_os1w6"]
texture = ExtResource("4_t166m")
15:7/0 = 0
16:7/0 = 0
0:8/0 = 0
1:8/0 = 0
2:8/0 = 0
4:8/0 = 0
5:8/0 = 0
13:8/0 = 0
14:8/0 = 0
15:8/0 = 0
16:8/0 = 0
17:8/0 = 0
0:9/0 = 0
1:9/0 = 0
2:9/0 = 0
3:9/0 = 0
4:9/0 = 0
5:9/0 = 0
6:9/0 = 0
7:9/0 = 0
9:9/0 = 0
10:9/0 = 0
11:9/0 = 0
12:9/0 = 0
13:9/0 = 0
14:9/0 = 0
15:9/0 = 0
16:9/0 = 0
17:9/0 = 0
0:10/0 = 0
1:10/0 = 0
2:10/0 = 0
3:10/0 = 0
4:10/0 = 0
5:10/0 = 0
6:10/0 = 0
7:10/0 = 0
8:10/0 = 0
9:10/0 = 0
10:10/0 = 0
11:10/0 = 0
12:10/0 = 0
13:10/0 = 0
14:10/0 = 0
15:10/0 = 0
16:10/0 = 0
17:10/0 = 0
[resource]
physics_layer_0/collision_layer = 1
sources/0 = SubResource("TileSetAtlasSource_aw6je")
sources/1 = SubResource("TileSetAtlasSource_dcg8p")
sources/2 = SubResource("TileSetAtlasSource_wdk1o")
sources/3 = SubResource("TileSetAtlasSource_os1w6")