diff --git a/febfabgame/Assets/graphics/objects/crate.png b/febfabgame/Assets/graphics/objects/crate.png new file mode 100644 index 0000000..2b8bdcd Binary files /dev/null and b/febfabgame/Assets/graphics/objects/crate.png differ diff --git a/febfabgame/Assets/graphics/objects/crate.png.import b/febfabgame/Assets/graphics/objects/crate.png.import new file mode 100644 index 0000000..9f6a56c --- /dev/null +++ b/febfabgame/Assets/graphics/objects/crate.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dbdeeja34rpcm" +path="res://.godot/imported/crate.png-b305173a2c67970ad0d8a144d4e63ff0.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/graphics/objects/crate.png" +dest_files=["res://.godot/imported/crate.png-b305173a2c67970ad0d8a144d4e63ff0.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/febfabgame/Assets/graphics/player/idle/Player Idle 48x48.png b/febfabgame/Assets/graphics/player/idle/Player Idle 48x48.png new file mode 100644 index 0000000..b618511 Binary files /dev/null and b/febfabgame/Assets/graphics/player/idle/Player Idle 48x48.png differ diff --git a/febfabgame/Assets/graphics/player/idle/Player Idle 48x48.png.import b/febfabgame/Assets/graphics/player/idle/Player Idle 48x48.png.import new file mode 100644 index 0000000..91485c2 --- /dev/null +++ b/febfabgame/Assets/graphics/player/idle/Player Idle 48x48.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://jnn6hcmfgyfo" +path="res://.godot/imported/Player Idle 48x48.png-89778dc220bc3b5e442a99d89a1e9928.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/graphics/player/idle/Player Idle 48x48.png" +dest_files=["res://.godot/imported/Player Idle 48x48.png-89778dc220bc3b5e442a99d89a1e9928.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/febfabgame/Assets/graphics/player/jump/player jump 48x48.png b/febfabgame/Assets/graphics/player/jump/player jump 48x48.png new file mode 100644 index 0000000..dff105c Binary files /dev/null and b/febfabgame/Assets/graphics/player/jump/player jump 48x48.png differ diff --git a/febfabgame/Assets/graphics/player/jump/player jump 48x48.png.import b/febfabgame/Assets/graphics/player/jump/player jump 48x48.png.import new file mode 100644 index 0000000..c590102 --- /dev/null +++ b/febfabgame/Assets/graphics/player/jump/player jump 48x48.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bv1oc2iwohejk" +path="res://.godot/imported/player jump 48x48.png-cb96bf53d7104a8fe475749788ee547c.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/graphics/player/jump/player jump 48x48.png" +dest_files=["res://.godot/imported/player jump 48x48.png-cb96bf53d7104a8fe475749788ee547c.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/febfabgame/Assets/graphics/player/run/player run 48x48.png b/febfabgame/Assets/graphics/player/run/player run 48x48.png new file mode 100644 index 0000000..aca5b55 Binary files /dev/null and b/febfabgame/Assets/graphics/player/run/player run 48x48.png differ diff --git a/febfabgame/Assets/graphics/player/run/player run 48x48.png.import b/febfabgame/Assets/graphics/player/run/player run 48x48.png.import new file mode 100644 index 0000000..bc71160 --- /dev/null +++ b/febfabgame/Assets/graphics/player/run/player run 48x48.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ciaht230dnmu3" +path="res://.godot/imported/player run 48x48.png-9864f67f072e7f64b36c65e3e85745f1.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/graphics/player/run/player run 48x48.png" +dest_files=["res://.godot/imported/player run 48x48.png-9864f67f072e7f64b36c65e3e85745f1.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/febfabgame/Assets/graphics/projectiles/pixel_bullet.png b/febfabgame/Assets/graphics/projectiles/pixel_bullet.png new file mode 100644 index 0000000..900d030 Binary files /dev/null and b/febfabgame/Assets/graphics/projectiles/pixel_bullet.png differ diff --git a/febfabgame/Assets/graphics/projectiles/pixel_bullet.png.import b/febfabgame/Assets/graphics/projectiles/pixel_bullet.png.import new file mode 100644 index 0000000..8d15dfd --- /dev/null +++ b/febfabgame/Assets/graphics/projectiles/pixel_bullet.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://n3642h5jwslv" +path="res://.godot/imported/pixel_bullet.png-ed71f7728f29fcc66cd3972db4fb4d47.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/graphics/projectiles/pixel_bullet.png" +dest_files=["res://.godot/imported/pixel_bullet.png-ed71f7728f29fcc66cd3972db4fb4d47.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/febfabgame/Scenes/bullet.tscn b/febfabgame/Scenes/bullet.tscn index b29f2ba..d6843b0 100644 --- a/febfabgame/Scenes/bullet.tscn +++ b/febfabgame/Scenes/bullet.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=3 format=3 uid="uid://cy7x36mdb5oxu"] +[gd_scene load_steps=4 format=3 uid="uid://cy7x36mdb5oxu"] [ext_resource type="Script" path="res://Scripts/bullet.gd" id="1_74gno"] +[ext_resource type="Texture2D" uid="uid://n3642h5jwslv" path="res://Assets/graphics/projectiles/pixel_bullet.png" id="2_abfvl"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_vnal2"] size = Vector2(20, 4) @@ -12,4 +13,9 @@ script = ExtResource("1_74gno") shape = SubResource("RectangleShape2D_vnal2") debug_color = Color(0.857955, 0.291109, 0.565473, 0.42) +[node name="Sprite2D" type="Sprite2D" parent="."] +position = Vector2(-5, 2) +scale = Vector2(-0.14505, 0.0734948) +texture = ExtResource("2_abfvl") + [connection signal="body_shape_entered" from="." to="." method="_on_body_shape_entered"] diff --git a/febfabgame/Scenes/crate.tscn b/febfabgame/Scenes/crate.tscn new file mode 100644 index 0000000..77a94a0 --- /dev/null +++ b/febfabgame/Scenes/crate.tscn @@ -0,0 +1,20 @@ +[gd_scene load_steps=3 format=3 uid="uid://bad28kns14sve"] + +[ext_resource type="Texture2D" uid="uid://dbdeeja34rpcm" path="res://Assets/graphics/objects/crate.png" id="1_jxgyj"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_57esh"] +size = Vector2(52, 56) + +[node name="Crate1" type="RigidBody2D"] +position = Vector2(-2, -2) +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource("RectangleShape2D_57esh") +debug_color = Color(0.812962, 0.406946, 0.115236, 0.42) + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture_filter = 1 +position = Vector2(0, 4) +scale = Vector2(0.186279, 0.198245) +texture = ExtResource("1_jxgyj") diff --git a/febfabgame/Scenes/feb_fab_game.tscn b/febfabgame/Scenes/feb_fab_game.tscn index 8ec03ae..965bd51 100644 --- a/febfabgame/Scenes/feb_fab_game.tscn +++ b/febfabgame/Scenes/feb_fab_game.tscn @@ -1,21 +1,22 @@ -[gd_scene load_steps=10 format=3 uid="uid://cpuc12n61qg6b"] +[gd_scene load_steps=12 format=3 uid="uid://cpuc12n61qg6b"] -[ext_resource type="Script" path="res://Scripts/trigger.gd" id="1_a0h8u"] [ext_resource type="Script" path="res://Scripts/gamecontroller.gd" id="1_amnm6"] +[ext_resource type="PackedScene" uid="uid://d0ve3ds64sk3p" path="res://Scenes/trigger.tscn" id="2_k6dhr"] [ext_resource type="PackedScene" uid="uid://b0snboj7mbad5" path="res://Scenes/player.tscn" id="3_3yq6m"] +[ext_resource type="PackedScene" uid="uid://bad28kns14sve" path="res://Scenes/crate.tscn" id="3_gnicf"] +[ext_resource type="Script" path="res://Scripts/crate.gd" id="4_5gakl"] [ext_resource type="PackedScene" uid="uid://cy7x36mdb5oxu" path="res://Scenes/bullet.tscn" id="4_bk63h"] [ext_resource type="Script" path="res://Scripts/scene_manager.gd" id="5_4nsas"] [sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_qkap3"] -[sub_resource type="CircleShape2D" id="CircleShape2D_skxer"] -radius = 48.0 - [sub_resource type="RectangleShape2D" id="RectangleShape2D_yfjal"] size = Vector2(65, 20) -[sub_resource type="RectangleShape2D" id="RectangleShape2D_57esh"] -size = Vector2(52, 56) +[sub_resource type="CircleShape2D" id="CircleShape2D_fgkk4"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_ilkes"] +size = Vector2(20, 134) [node name="FebFabGame" type="Node2D"] script = ExtResource("1_amnm6") @@ -27,15 +28,6 @@ metadata/_edit_group_ = true [node name="CollisionShape2D" type="CollisionShape2D" parent="Floor"] shape = SubResource("WorldBoundaryShape2D_qkap3") -[node name="Trigger" type="Area2D" parent="."] -position = Vector2(727, 529) -script = ExtResource("1_a0h8u") -metadata/_edit_group_ = true - -[node name="CollisionShape2D" type="CollisionShape2D" parent="Trigger"] -shape = SubResource("CircleShape2D_skxer") -debug_color = Color(0.50428, 0.445656, 0.95237, 0.42) - [node name="Level" type="Node2D" parent="."] [node name="Brick" type="StaticBody2D" parent="Level"] @@ -65,44 +57,23 @@ shape = SubResource("RectangleShape2D_yfjal") [node name="Crates" type="Node2D" parent="."] -[node name="Crate1" type="RigidBody2D" parent="Crates"] -position = Vector2(642, 251) -rotation = -0.585206 -metadata/_edit_group_ = true +[node name="Crate1" parent="Crates" instance=ExtResource("3_gnicf")] +position = Vector2(604, 239) +rotation = -0.26268 +script = ExtResource("4_5gakl") -[node name="CollisionShape2D" type="CollisionShape2D" parent="Crates/Crate1"] -shape = SubResource("RectangleShape2D_57esh") -debug_color = Color(0.812962, 0.406946, 0.115236, 0.42) +[node name="Crate2" parent="Crates" instance=ExtResource("3_gnicf")] +position = Vector2(340, 130) +rotation = 0.262166 +script = ExtResource("4_5gakl") -[node name="Crate4" type="RigidBody2D" parent="Crates"] -position = Vector2(353, 97) -rotation = 1.62165 -metadata/_edit_group_ = true - -[node name="CollisionShape2D" type="CollisionShape2D" parent="Crates/Crate4"] -shape = SubResource("RectangleShape2D_57esh") -debug_color = Color(0.812962, 0.406946, 0.115236, 0.42) - -[node name="Crate2" type="RigidBody2D" parent="Crates"] -position = Vector2(664, 155) -rotation = 0.531432 -metadata/_edit_group_ = true - -[node name="CollisionShape2D" type="CollisionShape2D" parent="Crates/Crate2"] -shape = SubResource("RectangleShape2D_57esh") -debug_color = Color(0.812962, 0.406946, 0.115236, 0.42) - -[node name="Crate3" type="RigidBody2D" parent="Crates"] -position = Vector2(843, 88) -rotation = 0.531432 -metadata/_edit_group_ = true - -[node name="CollisionShape2D" type="CollisionShape2D" parent="Crates/Crate3"] -shape = SubResource("RectangleShape2D_57esh") -debug_color = Color(0.812962, 0.406946, 0.115236, 0.42) +[node name="Crate3" parent="Crates" instance=ExtResource("3_gnicf")] +position = Vector2(849, 118) +rotation = -0.248451 +script = ExtResource("4_5gakl") [node name="CharacterBody2D" parent="." instance=ExtResource("3_3yq6m")] -position = Vector2(440, 243) +position = Vector2(158, 94) [node name="Area2D" parent="." instance=ExtResource("4_bk63h")] position = Vector2(236, 307) @@ -111,5 +82,20 @@ position = Vector2(236, 307) unique_name_in_owner = true script = ExtResource("5_4nsas") -[connection signal="areaTrigger" from="Trigger" to="." method="_on_trigger_area_trigger"] -[connection signal="body_entered" from="Trigger" to="Trigger" method="_on_body_entered"] +[node name="triggers" type="Node2D" parent="."] + +[node name="Trigger" parent="triggers" instance=ExtResource("2_k6dhr")] +effect = "destroy" + +[node name="CollisionShape2D" type="CollisionShape2D" parent="triggers/Trigger"] +shape = SubResource("CircleShape2D_fgkk4") +debug_color = Color(0.62821, 0.394472, 0.903221, 0.42) + +[node name="powerup" parent="triggers" instance=ExtResource("2_k6dhr")] +position = Vector2(949, 469) +effect = "powerup" + +[node name="CollisionShape2D" type="CollisionShape2D" parent="triggers/powerup"] +position = Vector2(4, -1) +shape = SubResource("RectangleShape2D_ilkes") +debug_color = Color(0.304464, 0.623664, 0.204875, 0.42) diff --git a/febfabgame/Scenes/player.tscn b/febfabgame/Scenes/player.tscn index 0c30ef3..7aefdea 100644 --- a/febfabgame/Scenes/player.tscn +++ b/febfabgame/Scenes/player.tscn @@ -1,9 +1,177 @@ -[gd_scene load_steps=3 format=3 uid="uid://b0snboj7mbad5"] +[gd_scene load_steps=28 format=3 uid="uid://b0snboj7mbad5"] [ext_resource type="Script" path="res://Scripts/Player.gd" id="1_mjl5w"] +[ext_resource type="Texture2D" uid="uid://jnn6hcmfgyfo" path="res://Assets/graphics/player/idle/Player Idle 48x48.png" id="2_20p21"] +[ext_resource type="Texture2D" uid="uid://ciaht230dnmu3" path="res://Assets/graphics/player/run/player run 48x48.png" id="3_ergv2"] +[ext_resource type="Texture2D" uid="uid://bv1oc2iwohejk" path="res://Assets/graphics/player/jump/player jump 48x48.png" id="3_riawr"] [sub_resource type="CircleShape2D" id="CircleShape2D_xiumq"] +[sub_resource type="AtlasTexture" id="AtlasTexture_u237n"] +atlas = ExtResource("2_20p21") +region = Rect2(0, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_mwuqw"] +atlas = ExtResource("2_20p21") +region = Rect2(48, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_gtkhb"] +atlas = ExtResource("2_20p21") +region = Rect2(96, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_vtevr"] +atlas = ExtResource("2_20p21") +region = Rect2(144, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_jrohu"] +atlas = ExtResource("2_20p21") +region = Rect2(192, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_rgamt"] +atlas = ExtResource("2_20p21") +region = Rect2(240, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_puq2s"] +atlas = ExtResource("2_20p21") +region = Rect2(288, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ppcu1"] +atlas = ExtResource("2_20p21") +region = Rect2(336, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_0p4g1"] +atlas = ExtResource("2_20p21") +region = Rect2(384, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_dg258"] +atlas = ExtResource("2_20p21") +region = Rect2(432, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ehgkh"] +atlas = ExtResource("3_riawr") +region = Rect2(0, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_w5jq5"] +atlas = ExtResource("3_riawr") +region = Rect2(48, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_d44wy"] +atlas = ExtResource("3_riawr") +region = Rect2(96, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_yr6yg"] +atlas = ExtResource("3_ergv2") +region = Rect2(0, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_tefua"] +atlas = ExtResource("3_ergv2") +region = Rect2(48, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_f0env"] +atlas = ExtResource("3_ergv2") +region = Rect2(96, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_uigva"] +atlas = ExtResource("3_ergv2") +region = Rect2(144, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_kiw7g"] +atlas = ExtResource("3_ergv2") +region = Rect2(192, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_5wcjn"] +atlas = ExtResource("3_ergv2") +region = Rect2(240, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_htmkr"] +atlas = ExtResource("3_ergv2") +region = Rect2(288, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_dyj62"] +atlas = ExtResource("3_ergv2") +region = Rect2(336, 0, 48, 48) + +[sub_resource type="SpriteFrames" id="SpriteFrames_tbufb"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_u237n") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_mwuqw") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_gtkhb") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_vtevr") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_jrohu") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_rgamt") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_puq2s") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ppcu1") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_0p4g1") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_dg258") +}], +"loop": true, +"name": &"idle", +"speed": 12.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_ehgkh") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_w5jq5") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_d44wy") +}], +"loop": false, +"name": &"jump", +"speed": 9.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_yr6yg") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_tefua") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_f0env") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_uigva") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_kiw7g") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_5wcjn") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_htmkr") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_dyj62") +}], +"loop": true, +"name": &"run", +"speed": 12.0 +}] + [node name="CharacterBody2D" type="CharacterBody2D"] script = ExtResource("1_mjl5w") metadata/_edit_group_ = true @@ -23,3 +191,13 @@ position = Vector2(24, -26) [node name="leftTarget" type="Node2D" parent="."] position = Vector2(-25, -26) + +[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] +texture_filter = 1 +position = Vector2(2, -11) +scale = Vector2(1.54734, 1.26736) +sprite_frames = SubResource("SpriteFrames_tbufb") +animation = &"jump" +autoplay = "jump" + +[node name="Camera2D" type="Camera2D" parent="."] diff --git a/febfabgame/Scenes/trigger.tscn b/febfabgame/Scenes/trigger.tscn new file mode 100644 index 0000000..aa1e6e3 --- /dev/null +++ b/febfabgame/Scenes/trigger.tscn @@ -0,0 +1,10 @@ +[gd_scene load_steps=2 format=3 uid="uid://d0ve3ds64sk3p"] + +[ext_resource type="Script" path="res://Scripts/trigger.gd" id="1_0ht8v"] + +[node name="Trigger" type="Area2D"] +position = Vector2(727, 529) +script = ExtResource("1_0ht8v") +metadata/_edit_group_ = true + +[connection signal="body_entered" from="." to="." method="_on_body_entered"] diff --git a/febfabgame/Scripts/Player.gd b/febfabgame/Scripts/Player.gd index 2fb12e5..f3f5822 100644 --- a/febfabgame/Scripts/Player.gd +++ b/febfabgame/Scripts/Player.gd @@ -1,4 +1,5 @@ -extends CharacterBody2D +class_name Player extends CharacterBody2D +@onready var playerGraphic: AnimatedSprite2D = $AnimatedSprite2D const SPEED = 200.0 @@ -9,6 +10,7 @@ var faceLeft = false var pushRightEnabled = false var pushLeftEnabled = false var pushTarget +var isJumping = false @onready var right_cast: RayCast2D = $rightCast @onready var left_cast: RayCast2D = $leftCast @@ -21,10 +23,16 @@ func _physics_process(delta: float) -> void: # Add the gravity. if not is_on_floor(): velocity += get_gravity() * delta + else: + isJumping = false + + # Handle jump. if Input.is_action_just_pressed("ui_accept") and is_on_floor(): velocity.y = JUMP_VELOCITY + isJumping = true + playerGraphic.play("jump") # Get the input direction and handle the movement/deceleration. # As good practice, you should replace UI actions with custom gameplay actions. @@ -47,11 +55,19 @@ func _physics_process(delta: float) -> void: velocity.x = direction * SPEED else: velocity.x = move_toward(velocity.x, 0, SPEED) + if direction: + if not isJumping: + playerGraphic.play("run") + if direction ==0: + if not isJumping: + playerGraphic.play("idle") if direction <0: faceLeft = true + playerGraphic.flip_h = true if direction >0: faceLeft = false + playerGraphic.flip_h = false move_and_slide() diff --git a/febfabgame/Scripts/bullet.gd b/febfabgame/Scripts/bullet.gd index f1962ee..909ae2c 100644 --- a/febfabgame/Scripts/bullet.gd +++ b/febfabgame/Scripts/bullet.gd @@ -1,4 +1,5 @@ class_name Bullet extends Area2D +@onready var bulletGraphic: Sprite2D = $Sprite2D var speed = 750 @@ -6,6 +7,10 @@ signal hit(bullet, body) func setSpeed(value): speed = value + if speed <0: + bulletGraphic.flip_h = true + if speed >0: + bulletGraphic.flip_h = false #animation func _physics_process(delta: float) -> void: @@ -14,4 +19,5 @@ func _physics_process(delta: float) -> void: func _on_body_shape_entered(body_rid: RID, body: Node2D, body_shape_index: int, local_shape_index: int) -> void: print("bullet collision") - hit.emit(self, body) + if not body is Player: + hit.emit(self, body) diff --git a/febfabgame/Scripts/crate.gd b/febfabgame/Scripts/crate.gd new file mode 100644 index 0000000..7f42195 --- /dev/null +++ b/febfabgame/Scripts/crate.gd @@ -0,0 +1 @@ +class_name Crate extends RigidBody2D diff --git a/febfabgame/Scripts/gamecontroller.gd b/febfabgame/Scripts/gamecontroller.gd index 3676b48..cd28dd8 100644 --- a/febfabgame/Scripts/gamecontroller.gd +++ b/febfabgame/Scripts/gamecontroller.gd @@ -1,4 +1,4 @@ -extends Node2D +class_name GameController extends Node2D # Game Data var totalCrates = 4 @@ -9,17 +9,35 @@ var cratesDestroyed = 0 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: pass -func _on_trigger_area_trigger(body) -> void: - print("game controller knows about crate destruction") - cratesDestroyed +=1 - totalCrates -=1 - #kill em - body.queue_free() - if totalCrates <=0: - print("win") +func _on_trigger_area_trigger(effect, body) -> void: + print("Do effect "+effect) + match effect: + "destroy": + #write code to destroy + if body is Crate: + %SceneManager.destroy(body) + cratesDestroyed +=1 + "powerup": + #write code to powerup + if body is Player: + print("POWERRRRRR UP") + #Player.SPEED = 700 + + + +func bulletHit(body): + print("game controller knows bullet hit") + if body is Crate: + print("you've hit a crate") + cratesDestroyed +=1 + %SceneManager.destroy(body) + print("crates Remaining :: "+str(totalCrates - cratesDestroyed)) + +func numberOfCrates(value): + totalCrates = value + print("Game Controller know scrates "+str(totalCrates)) diff --git a/febfabgame/Scripts/scene_manager.gd b/febfabgame/Scripts/scene_manager.gd index 60931ca..c0dda85 100644 --- a/febfabgame/Scripts/scene_manager.gd +++ b/febfabgame/Scripts/scene_manager.gd @@ -1,4 +1,7 @@ extends Node +@onready var gameController: GameController = $".." +@onready var crates: Node2D = $"../Crates" +@onready var triggers: Node2D = $"../triggers" var bulletsFiredTotal = 0 var bulletsMadeTotal = 0 @@ -19,6 +22,7 @@ func bulletFactory(): bulletArray.push_front(mybullet) return mybullet + # order desk for bullets func makeBullet(position, speed): print("make a bullet") @@ -26,11 +30,30 @@ func makeBullet(position, speed): owner.add_child(newBullet) newBullet.setSpeed(speed) newBullet.transform = position + func bulletHit(bullet, body): print("tell the game controller a bullet hit smthn") + gameController.bulletHit(body) + bullet.setSpeed(0) + bullet.position = Vector2(-100,-100) +func destroy(body): + body.queue_free() +func buildLevel(): + #how many crates? + var totalCrates = 0 + for obj in crates.get_children(): + if obj is Crate: + totalCrates +=1 + gameController.numberOfCrates(totalCrates) + #wire up the triggers + for obj in triggers.get_children(): + if obj is Trigger: + #wire up to GC + obj.areaTrigger.connect(gameController._on_trigger_area_trigger) - +func _ready() -> void: + buildLevel() diff --git a/febfabgame/Scripts/trigger.gd b/febfabgame/Scripts/trigger.gd index e357803..097692b 100644 --- a/febfabgame/Scripts/trigger.gd +++ b/febfabgame/Scripts/trigger.gd @@ -1,11 +1,13 @@ -extends Area2D +class_name Trigger extends Area2D +@export var effect="alert" -signal areaTrigger(Object) +signal areaTrigger(effect, Object) # Called when the node enters the scene tree for the first time. func _ready() -> void: print("Trigger is Active") + # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: pass @@ -13,4 +15,4 @@ func _process(delta: float) -> void: func _on_body_entered(body: Node2D) -> void: print("body collision in trigger") - areaTrigger.emit(body) + areaTrigger.emit(effect, body) diff --git a/febfabgame/project.godot b/febfabgame/project.godot index 832079a..6c6d3f2 100644 --- a/febfabgame/project.godot +++ b/febfabgame/project.godot @@ -15,6 +15,14 @@ run/main_scene="res://Scenes/feb_fab_game.tscn" config/features=PackedStringArray("4.3", "Forward Plus") config/icon="res://icon.svg" +[display] + +window/size/viewport_width=428 +window/size/viewport_height=240 +window/size/window_width_override=960 +window/size/window_height_override=540 +window/stretch/mode="viewport" + [file_customization] folder_colors={