diff --git a/gmtk_2024/levels/level_1.tscn b/gmtk_2024/levels/level_1.tscn index b13a83f..f69a9bc 100644 --- a/gmtk_2024/levels/level_1.tscn +++ b/gmtk_2024/levels/level_1.tscn @@ -1,10 +1,12 @@ -[gd_scene load_steps=10 format=4 uid="uid://cxsstkfcffdch"] +[gd_scene load_steps=12 format=4 uid="uid://cxsstkfcffdch"] [ext_resource type="PackedScene" uid="uid://ba6afuig8bqrg" path="res://levels/LevelBase.tscn" id="1_87xn7"] [ext_resource type="Texture2D" uid="uid://c3m4os8kteaix" path="res://textures/level01-spritesheet.png" id="2_wqskp"] [ext_resource type="Shader" path="res://shaders/scrolling.gdshader" id="4_0x2h7"] [ext_resource type="Texture2D" uid="uid://bn7cejgxkah8o" path="res://textures/Level 01.png" id="5_4p03u"] +[ext_resource type="PackedScene" uid="uid://c6g2f7tm7iasr" path="res://objects/PressurePlate.tscn" id="7_i8kgx"] [ext_resource type="PackedScene" uid="uid://br6fngf5208j0" path="res://objects/ResizableBlockBig.tscn" id="8_ec71m"] +[ext_resource type="PackedScene" uid="uid://c168bkledwyya" path="res://objects/Laser.tscn" id="8_gxgbn"] [ext_resource type="PackedScene" uid="uid://dki3ft77fr3tc" path="res://objects/BreakableBlock.tscn" id="9_2ia1u"] [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_e817v"] @@ -145,7 +147,7 @@ position = Vector2(338, 15) [node name="Layer0" type="TileMapLayer" parent="." index="4"] use_parent_material = true -tile_map_data = PackedByteArray("AAD2//v/AAADAAAAAAD2//z/AAACAAEAAAD2//3/AAACAAEAAAD2//7/AAACAAEAAAD2////AAACAAEAAAD2/wAAAAACAAEAAAD2/wEAAAACAAEAAAD2/wIAAAACAAEAAAD2/wMAAAACAAEAAAD2/wQAAAADAAIAAAAJAPv/AAAFAAAAAAAJAPz/AAAAAAEAAAAJAP3/AAAAAAEAAAAJAP7/AAAAAAEAAAAJAP//AAAAAAEAAAAJAAAAAAAAAAEAAAAJAAEAAAAAAAEAAA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IAAAABAAEAAAACAAAAAAABAAIAAAACAAEAAAABAAMAAAACAAEAAAD//wMAAAAFAAIAAAAAAAIAAAABAAEAAAAAAAMAAAABAAEAAAD3/wAAAAAIAAEAAGD4/wAAAAAIAAEAAGD5/wAAAAAIAAEAAGD6/wAAAAAIAAEAAGD7/wAAAAAIAAAAAVD3//3/AAAIAAEAAFD4//3/AAAIAAEAAFD5//3/AAAIAAEAAFD6//3/AAAIAAEAAFD7//3/AAAIAAEAAFD8//3/AAAIAAEAAFD9//3/AAAIAAEAAFD+//3/AAACAAAAAAAAAP//AAABAAIAAAD/////AAAAAAIAAAD///7/AAAHAAAAAAAAAP7/AAACAAAAAAABAP//AAAIAAAAAVD+//7/AAAAAAIAAAAFAAEAAAAIAAAAAAAFAAIAAAAIAAAAAQA=") tile_set = SubResource("TileSet_n3khe") [node name="TextureRect" type="TextureRect" parent="." index="5"] @@ -167,8 +169,15 @@ stretch_mode = 1 position = Vector2(-65, 63) [node name="Block2" parent="." index="7" instance=ExtResource("8_ec71m")] -position = Vector2(-255, -32) +position = Vector2(-249, -32) scale = Vector2(0.5, 0.5) [node name="BreakableBlock" parent="." index="8" instance=ExtResource("9_2ia1u")] position = Vector2(241, -47) + +[node name="PressurePlate" parent="." index="9" instance=ExtResource("7_i8kgx")] +position = Vector2(-272, -32) +rotation = 1.5756 + +[node name="StaticBody2D" parent="." index="10" instance=ExtResource("8_gxgbn")] +position = Vector2(15, 15) diff --git a/gmtk_2024/objects/Goal.tscn b/gmtk_2024/objects/Goal.tscn index 6d94b50..f81a48b 100644 --- a/gmtk_2024/objects/Goal.tscn +++ b/gmtk_2024/objects/Goal.tscn @@ -3,6 +3,21 @@ [ext_resource type="Script" path="res://scripts/goal.gd" id="1_xjaxa"] [ext_resource type="Texture2D" uid="uid://bje753fyfin0" path="res://textures/01-Portal-Sheet.png" id="2_hsts4"] +[sub_resource type="Animation" id="Animation_v2oub"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite2D:frame_coords") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [Vector2i(0, 0)] +} + [sub_resource type="Animation" id="Animation_a6qt0"] resource_name = "portal" length = 0.55 @@ -20,21 +35,6 @@ tracks/0/keys = { "values": [Vector2i(0, 0), Vector2i(1, 0), Vector2i(2, 0), Vector2i(3, 0), Vector2i(4, 0), Vector2i(5, 0), Vector2i(6, 0), Vector2i(7, 0)] } -[sub_resource type="Animation" id="Animation_v2oub"] -length = 0.001 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("Sprite2D:frame_coords") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [Vector2i(0, 0)] -} - [sub_resource type="AnimationLibrary" id="AnimationLibrary_4pqp1"] _data = { "RESET": SubResource("Animation_v2oub"), diff --git a/gmtk_2024/objects/Laser.tscn b/gmtk_2024/objects/Laser.tscn new file mode 100644 index 0000000..52dd954 --- /dev/null +++ b/gmtk_2024/objects/Laser.tscn @@ -0,0 +1,34 @@ +[gd_scene load_steps=5 format=3 uid="uid://c168bkledwyya"] + +[ext_resource type="Texture2D" uid="uid://c3m4os8kteaix" path="res://textures/level01-spritesheet.png" id="1_6whpg"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_dplbn"] +atlas = ExtResource("1_6whpg") +region = Rect2(192.002, 64.0069, 32.0036, 31.9977) + +[sub_resource type="AtlasTexture" id="AtlasTexture_7sk3t"] +atlas = ExtResource("1_6whpg") +region = Rect2(128.019, 31.9952, 31.9608, 31.9949) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_jee2l"] +size = Vector2(6, 28.5) + +[node name="StaticBody2D" type="StaticBody2D"] +collision_mask = 5 + +[node name="Sprite2D2" type="Sprite2D" parent="."] +position = Vector2(1, 0) +texture = SubResource("AtlasTexture_dplbn") + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."] +polygon = PackedVector2Array(-15, -15, -12, -11, 14, -11, 17, -15) + +[node name="StaticBody2D" type="StaticBody2D" parent="."] + +[node name="Sprite2D" type="Sprite2D" parent="StaticBody2D"] +texture = SubResource("AtlasTexture_7sk3t") +region_rect = Rect2(0, 0, 288, 96) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"] +position = Vector2(1, 2) +shape = SubResource("RectangleShape2D_jee2l") diff --git a/gmtk_2024/objects/Player.tscn b/gmtk_2024/objects/Player.tscn index b6c72c0..55fef0e 100644 --- a/gmtk_2024/objects/Player.tscn +++ b/gmtk_2024/objects/Player.tscn @@ -13,7 +13,7 @@ radius = 12.0 [node name="Player" type="CharacterBody2D"] collision_layer = 4 -collision_mask = 19 +collision_mask = 51 script = ExtResource("1_a6lhy") jump_strength = 600 diff --git a/gmtk_2024/objects/Pre676A.tmp b/gmtk_2024/objects/Pre676A.tmp new file mode 100644 index 0000000..2581e0b --- /dev/null +++ b/gmtk_2024/objects/Pre676A.tmp @@ -0,0 +1,89 @@ +[gd_scene load_steps=9 format=3 uid="uid://c6g2f7tm7iasr"] + +[ext_resource type="Script" path="res://scripts/PressurePlate.gd" id="1_7ar3x"] +[ext_resource type="Texture2D" uid="uid://cwf57p0osmc0w" path="res://textures/PressurePlate.png" id="1_st48m"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_82l2r"] +size = Vector2(32, 3.5) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_c6ukx"] +size = Vector2(24, 4) + +[sub_resource type="Animation" id="Animation_fulu2"] +resource_name = "Disable" +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite2D:frame") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [1] +} + +[sub_resource type="Animation" id="Animation_7ggr5"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite2D:frame") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [1] +} + +[sub_resource type="Animation" id="Animation_xxdm0"] +resource_name = "Enable" +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite2D:frame") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [0] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_usrhb"] +_data = { +"Disable": SubResource("Animation_fulu2"), +"Enable": SubResource("Animation_xxdm0"), +"RESET": SubResource("Animation_7ggr5") +} + +[node name="StaticBody2D" type="StaticBody2D"] +script = ExtResource("1_7ar3x") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2(0, 13.75) +shape = SubResource("RectangleShape2D_82l2r") + +[node name="Area2D" type="Area2D" parent="."] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] +position = Vector2(0, 10) +shape = SubResource("RectangleShape2D_c6ukx") + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture = ExtResource("1_st48m") +hframes = 2 +frame = 1 + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +libraries = { +"": SubResource("AnimationLibrary_usrhb") +} +autoplay = "Disable" + +[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"] +[connection signal="body_exited" from="Area2D" to="." method="_on_area_2d_body_exited"] diff --git a/gmtk_2024/objects/PressurePlate.tscn b/gmtk_2024/objects/PressurePlate.tscn new file mode 100644 index 0000000..de405c8 --- /dev/null +++ b/gmtk_2024/objects/PressurePlate.tscn @@ -0,0 +1,86 @@ +[gd_scene load_steps=8 format=3 uid="uid://c6g2f7tm7iasr"] + +[ext_resource type="Script" path="res://scripts/PressurePlate.gd" id="1_7ar3x"] +[ext_resource type="Texture2D" uid="uid://cwf57p0osmc0w" path="res://textures/PressurePlate.png" id="1_st48m"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_c6ukx"] +size = Vector2(24, 5) + +[sub_resource type="Animation" id="Animation_fulu2"] +resource_name = "Disable" +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite2D:frame") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [1] +} + +[sub_resource type="Animation" id="Animation_7ggr5"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite2D:frame") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [1] +} + +[sub_resource type="Animation" id="Animation_xxdm0"] +resource_name = "Enable" +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite2D:frame") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [0] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_usrhb"] +_data = { +"Disable": SubResource("Animation_fulu2"), +"Enable": SubResource("Animation_xxdm0"), +"RESET": SubResource("Animation_7ggr5") +} + +[node name="PressurePlate" type="StaticBody2D"] +collision_mask = 5 +script = ExtResource("1_7ar3x") + +[node name="Area2D" type="Area2D" parent="."] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] +position = Vector2(0, 9.5) +shape = SubResource("RectangleShape2D_c6ukx") + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."] +polygon = PackedVector2Array(-16, 16, -12, 12, 12, 12, 16, 16) + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture = ExtResource("1_st48m") +hframes = 2 +frame = 1 + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +libraries = { +"": SubResource("AnimationLibrary_usrhb") +} +autoplay = "Enable" + +[connection signal="body_entered" from="Area2D" to="." method="_on_body_entered"] +[connection signal="body_exited" from="Area2D" to="." method="_on_body_exited"] diff --git a/gmtk_2024/objects/ResizableBlockBig.tscn b/gmtk_2024/objects/ResizableBlockBig.tscn index b743fcd..93b7c7d 100644 --- a/gmtk_2024/objects/ResizableBlockBig.tscn +++ b/gmtk_2024/objects/ResizableBlockBig.tscn @@ -1,13 +1,9 @@ -[gd_scene load_steps=4 format=3 uid="uid://br6fngf5208j0"] +[gd_scene load_steps=3 format=3 uid="uid://br6fngf5208j0"] [ext_resource type="Script" path="res://scripts/resizable_block.gd" id="1_j40bu"] [ext_resource type="Texture2D" uid="uid://bb8vdlgwpj8oc" path="res://textures/antivirus-block-big.png" id="3_lb374"] -[sub_resource type="RectangleShape2D" id="RectangleShape2D_sgemy"] -size = Vector2(59, 59) - [node name="Block" type="StaticBody2D"] -collision_layer = 17 collision_mask = 22 input_pickable = true script = ExtResource("1_j40bu") @@ -15,7 +11,7 @@ script = ExtResource("1_j40bu") [node name="Sprite2D" type="Sprite2D" parent="."] texture = ExtResource("3_lb374") -[node name="CollisionShape2D" type="CollisionShape2D" parent="."] -shape = SubResource("RectangleShape2D_sgemy") +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."] +polygon = PackedVector2Array(-32, -20, -28, -20, -28, -24, -24, -24, -24, -28, -20, -28, -20, -32, 20, -32, 20, -28, 24, -28, 24, -24, 28, -24, 28, -20, 32, -20, 32, 20, 28, 20, 28, 24, 24, 24, 24, 28, 20, 28, 20, 32, -20, 32, -20, 28, -24, 28, -24, 24, -28, 24, -28, 20, -32, 20) [connection signal="input_event" from="." to="." method="_on_input_event"] diff --git a/gmtk_2024/scripts/PressurePlate.gd b/gmtk_2024/scripts/PressurePlate.gd new file mode 100644 index 0000000..029a52c --- /dev/null +++ b/gmtk_2024/scripts/PressurePlate.gd @@ -0,0 +1,35 @@ +extends StaticBody2D + +@export var laser_path: NodePath # TODO +@export var required_scale: Vector2 = Vector2(1.0, 1.0) +@export var player_required_scale: Vector2 = Vector2(2.0, 2.0) + +@onready var animation = $AnimationPlayer + +var laser: Node2D = null +var is_activated = false + +func _ready(): + laser = get_node(laser_path) + +func _on_body_entered(body: Node): + print("Wird erkannt") + if (body is StaticBody2D and body.scale >= required_scale) or (body is CharacterBody2D and body.scale >= player_required_scale): + animation.play("Disable") + activate_plate() + +func _on_body_exited(body: Node): + if (body is StaticBody2D and body.scale >= required_scale) or (body is CharacterBody2D and body.scale >= player_required_scale): + animation.play("Enable") + deactivate_plate() + +func activate_plate(): + print("wird aktiviert") + if not is_activated: + is_activated = true + if laser: + laser.queue_free() + +func deactivate_plate(): + if is_activated: + is_activated = false diff --git a/gmtk_2024/textures/PressurePlate.png b/gmtk_2024/textures/PressurePlate.png new file mode 100644 index 0000000..cb13eb1 Binary files /dev/null and b/gmtk_2024/textures/PressurePlate.png differ