diff --git a/februarygodotgame/assets/graphics/objects/crate.png b/februarygodotgame/assets/graphics/objects/crate.png new file mode 100644 index 0000000..2b8bdcd Binary files /dev/null and b/februarygodotgame/assets/graphics/objects/crate.png differ diff --git a/februarygodotgame/assets/graphics/objects/crate.png.import b/februarygodotgame/assets/graphics/objects/crate.png.import new file mode 100644 index 0000000..e1dad36 --- /dev/null +++ b/februarygodotgame/assets/graphics/objects/crate.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://clmv1sjkccjts" +path="res://.godot/imported/crate.png-b286bd97caa3cbc59746f2db7de46191.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/objects/crate.png" +dest_files=["res://.godot/imported/crate.png-b286bd97caa3cbc59746f2db7de46191.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/februarygodotgame/assets/graphics/player/idle/Player Idle 48x48.png b/februarygodotgame/assets/graphics/player/idle/Player Idle 48x48.png new file mode 100644 index 0000000..b618511 Binary files /dev/null and b/februarygodotgame/assets/graphics/player/idle/Player Idle 48x48.png differ diff --git a/februarygodotgame/assets/graphics/player/idle/Player Idle 48x48.png.import b/februarygodotgame/assets/graphics/player/idle/Player Idle 48x48.png.import new file mode 100644 index 0000000..fbb5ec0 --- /dev/null +++ b/februarygodotgame/assets/graphics/player/idle/Player Idle 48x48.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://70imyp6vsgvv" +path="res://.godot/imported/Player Idle 48x48.png-9f43f14976963a2821a06ddf8579a76a.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-9f43f14976963a2821a06ddf8579a76a.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/februarygodotgame/assets/graphics/player/jump/player jump 48x48(1).png b/februarygodotgame/assets/graphics/player/jump/player jump 48x48(1).png new file mode 100644 index 0000000..dff105c Binary files /dev/null and b/februarygodotgame/assets/graphics/player/jump/player jump 48x48(1).png differ diff --git a/februarygodotgame/assets/graphics/player/jump/player jump 48x48(1).png.import b/februarygodotgame/assets/graphics/player/jump/player jump 48x48(1).png.import new file mode 100644 index 0000000..032f0ef --- /dev/null +++ b/februarygodotgame/assets/graphics/player/jump/player jump 48x48(1).png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://5ger8sg6iqqm" +path="res://.godot/imported/player jump 48x48(1).png-fa7880cd69f0b548526679985442ae31.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/player/jump/player jump 48x48(1).png" +dest_files=["res://.godot/imported/player jump 48x48(1).png-fa7880cd69f0b548526679985442ae31.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/februarygodotgame/assets/graphics/player/run/player run 48x48(1).png b/februarygodotgame/assets/graphics/player/run/player run 48x48(1).png new file mode 100644 index 0000000..aca5b55 Binary files /dev/null and b/februarygodotgame/assets/graphics/player/run/player run 48x48(1).png differ diff --git a/februarygodotgame/assets/graphics/player/run/player run 48x48(1).png.import b/februarygodotgame/assets/graphics/player/run/player run 48x48(1).png.import new file mode 100644 index 0000000..4b0a699 --- /dev/null +++ b/februarygodotgame/assets/graphics/player/run/player run 48x48(1).png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://crd320y5xhgwf" +path="res://.godot/imported/player run 48x48(1).png-eadbacc6e08d791a092ddb9cb1f96f0d.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/player/run/player run 48x48(1).png" +dest_files=["res://.godot/imported/player run 48x48(1).png-eadbacc6e08d791a092ddb9cb1f96f0d.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/februarygodotgame/assets/graphics/projectiles/pixel_bullet.png b/februarygodotgame/assets/graphics/projectiles/pixel_bullet.png new file mode 100644 index 0000000..900d030 Binary files /dev/null and b/februarygodotgame/assets/graphics/projectiles/pixel_bullet.png differ diff --git a/februarygodotgame/assets/graphics/projectiles/pixel_bullet.png.import b/februarygodotgame/assets/graphics/projectiles/pixel_bullet.png.import new file mode 100644 index 0000000..16b0011 --- /dev/null +++ b/februarygodotgame/assets/graphics/projectiles/pixel_bullet.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bsskoq57i4q43" +path="res://.godot/imported/pixel_bullet.png-30d6d1e8b5e1332f8b2e2cee72a9e790.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/projectiles/pixel_bullet.png" +dest_files=["res://.godot/imported/pixel_bullet.png-30d6d1e8b5e1332f8b2e2cee72a9e790.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/februarygodotgame/project.godot b/februarygodotgame/project.godot index da1f61b..e57c21b 100644 --- a/februarygodotgame/project.godot +++ b/februarygodotgame/project.godot @@ -15,6 +15,14 @@ run/main_scene="res://scenes/game.tscn" config/features=PackedStringArray("4.3", "Forward Plus") config/icon="res://icon.svg" +[display] + +window/size/viewport_width=320 +window/size/viewport_height=180 +window/size/window_width_override=960 +window/size/window_height_override=540 +window/stretch/mode="viewport" + [file_customization] folder_colors={ diff --git a/februarygodotgame/scenes/bullet.tscn b/februarygodotgame/scenes/bullet.tscn index d70f953..293bad7 100644 --- a/februarygodotgame/scenes/bullet.tscn +++ b/februarygodotgame/scenes/bullet.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=3 format=3 uid="uid://dwy0c50ndnu8k"] +[gd_scene load_steps=4 format=3 uid="uid://dwy0c50ndnu8k"] [ext_resource type="Script" path="res://scripts/bullet.gd" id="1_v85g0"] +[ext_resource type="Texture2D" uid="uid://bsskoq57i4q43" path="res://assets/graphics/projectiles/pixel_bullet.png" id="2_ri5lc"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_pwf7j"] size = Vector2(20, 4) @@ -12,4 +13,9 @@ script = ExtResource("1_v85g0") shape = SubResource("RectangleShape2D_pwf7j") debug_color = Color(0.932915, 0.177129, 0.479323, 0.42) +[node name="Sprite2D" type="Sprite2D" parent="."] +position = Vector2(-6, -2) +scale = Vector2(-0.148858, -0.156823) +texture = ExtResource("2_ri5lc") + [connection signal="body_entered" from="." to="." method="_on_body_entered"] diff --git a/februarygodotgame/scenes/crate.tscn b/februarygodotgame/scenes/crate.tscn new file mode 100644 index 0000000..78a3a91 --- /dev/null +++ b/februarygodotgame/scenes/crate.tscn @@ -0,0 +1,24 @@ +[gd_scene load_steps=3 format=3 uid="uid://blcbdwowx2gr0"] + +[ext_resource type="Texture2D" uid="uid://clmv1sjkccjts" path="res://assets/graphics/objects/crate.png" id="1_7dn7o"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_oospb"] +size = Vector2(23.4985, 66.016) + +[node name="crate1" type="RigidBody2D"] +rotation = 1.0074 +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2(0.791419, -3.05451) +rotation = -1.01686 +scale = Vector2(2.89246, 1) +shape = SubResource("RectangleShape2D_oospb") +debug_color = Color(0.907205, 0.191988, 0.583153, 0.42) + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture_filter = 1 +position = Vector2(-1.37951, 0.311383) +rotation = 0.560473 +scale = Vector2(0.228016, 0.220525) +texture = ExtResource("1_7dn7o") diff --git a/februarygodotgame/scenes/game.tscn b/februarygodotgame/scenes/game.tscn index 6dde4e9..6fae98c 100644 --- a/februarygodotgame/scenes/game.tscn +++ b/februarygodotgame/scenes/game.tscn @@ -1,38 +1,31 @@ -[gd_scene load_steps=10 format=3 uid="uid://dhopuj38ic6dp"] +[gd_scene load_steps=12 format=3 uid="uid://dhopuj38ic6dp"] -[ext_resource type="Script" path="res://scripts/trigger.gd" id="1_7cb3s"] [ext_resource type="Script" path="res://scripts/gamecontroller.gd" id="1_dasmg"] +[ext_resource type="PackedScene" uid="uid://dgos05617rcuq" path="res://scenes/trigger.tscn" id="2_070us"] +[ext_resource type="PackedScene" uid="uid://blcbdwowx2gr0" path="res://scenes/crate.tscn" id="3_4f2of"] [ext_resource type="PackedScene" uid="uid://du8aftivw4k25" path="res://scenes/player.tscn" id="3_glxkt"] [ext_resource type="PackedScene" uid="uid://dwy0c50ndnu8k" path="res://scenes/bullet.tscn" id="4_2bgno"] +[ext_resource type="Script" path="res://scripts/crate.gd" id="4_4n32v"] [ext_resource type="Script" path="res://scripts/scene_manager.gd" id="5_6wvkt"] -[sub_resource type="CircleShape2D" id="CircleShape2D_ox8o7"] -radius = 31.0161 - [sub_resource type="RectangleShape2D" id="RectangleShape2D_uopew"] size = Vector2(70, 26) [sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_igau3"] -[sub_resource type="RectangleShape2D" id="RectangleShape2D_oospb"] -size = Vector2(43.1503, 26) +[sub_resource type="CircleShape2D" id="CircleShape2D_8p7pp"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_ape5f"] +size = Vector2(20, 46) [node name="Game" type="Node2D"] script = ExtResource("1_dasmg") -[node name="Trigger" type="Area2D" parent="."] -position = Vector2(570, 452) -script = ExtResource("1_7cb3s") -metadata/_edit_group_ = true - -[node name="CollisionShape2D" type="CollisionShape2D" parent="Trigger"] -shape = SubResource("CircleShape2D_ox8o7") -debug_color = Color(0.448323, 0.465614, 0.961841, 0.42) - [node name="Level" type="Node2D" parent="."] +position = Vector2(-12, -3) [node name="StaticBody2D" type="StaticBody2D" parent="Level"] -position = Vector2(525, 412) +position = Vector2(479, 385) metadata/_edit_group_ = true [node name="CollisionShape2D" type="CollisionShape2D" parent="Level/StaticBody2D"] @@ -40,16 +33,25 @@ position = Vector2(-26, 3) shape = SubResource("RectangleShape2D_uopew") [node name="StaticBody2D3" type="StaticBody2D" parent="Level"] -position = Vector2(525, 412) -rotation = 2.16668 +position = Vector2(588, 494) +rotation = 3.16193 metadata/_edit_group_ = true [node name="CollisionShape2D" type="CollisionShape2D" parent="Level/StaticBody2D3"] position = Vector2(-26, 3) shape = SubResource("RectangleShape2D_uopew") +[node name="StaticBody2D4" type="StaticBody2D" parent="Level"] +position = Vector2(345, 490) +rotation = 3.16193 +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Level/StaticBody2D4"] +position = Vector2(-26, 3) +shape = SubResource("RectangleShape2D_uopew") + [node name="StaticBody2D2" type="StaticBody2D" parent="Level"] -position = Vector2(11, 464) +position = Vector2(10, 528) metadata/_edit_group_ = true [node name="CollisionShape2D" type="CollisionShape2D" parent="Level/StaticBody2D2"] @@ -57,28 +59,23 @@ position = Vector2(518, 20) shape = SubResource("WorldBoundaryShape2D_igau3") [node name="crates" type="Node2D" parent="."] +position = Vector2(13, 53) -[node name="crate2" type="RigidBody2D" parent="crates"] -position = Vector2(616, 580) -rotation = -0.385715 -metadata/_edit_group_ = true +[node name="crate1" parent="crates" instance=ExtResource("3_4f2of")] +position = Vector2(141, 371) +script = ExtResource("4_4n32v") -[node name="CollisionShape2D" type="CollisionShape2D" parent="crates/crate2"] -position = Vector2(107.026, -85.1608) -shape = SubResource("RectangleShape2D_oospb") -debug_color = Color(0.907205, 0.191988, 0.583153, 0.42) +[node name="crate2" parent="crates" instance=ExtResource("3_4f2of")] +position = Vector2(699, 397) +script = ExtResource("4_4n32v") -[node name="crate1" type="RigidBody2D" parent="crates"] -position = Vector2(193, 264) -rotation = 0.807772 -metadata/_edit_group_ = true +[node name="crate3" parent="crates" instance=ExtResource("3_4f2of")] +position = Vector2(575, 177) +script = ExtResource("4_4n32v") -[node name="CollisionShape2D" type="CollisionShape2D" parent="crates/crate1"] -position = Vector2(23.712, 8.64544) -rotation = -1.01686 -scale = Vector2(2.89246, 1) -shape = SubResource("RectangleShape2D_oospb") -debug_color = Color(0.907205, 0.191988, 0.583153, 0.42) +[node name="crate4" parent="crates" instance=ExtResource("3_4f2of")] +position = Vector2(217, 230) +script = ExtResource("4_4n32v") [node name="CharacterBody2D" parent="." instance=ExtResource("3_glxkt")] position = Vector2(338, 226) @@ -90,5 +87,23 @@ position = Vector2(330, 271) unique_name_in_owner = true script = ExtResource("5_6wvkt") -[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="."] +rotation = -0.0128695 + +[node name="Trigger" parent="triggers" instance=ExtResource("2_070us")] +position = Vector2(509.188, 532.597) +rotation = -1.90254 +effect = "destroy" + +[node name="CollisionShape2D" type="CollisionShape2D" parent="triggers/Trigger"] +shape = SubResource("CircleShape2D_8p7pp") +debug_color = Color(0.622849, 0.37564, 0.95389, 0.42) + +[node name="powerup" parent="triggers" instance=ExtResource("2_070us")] +position = Vector2(597.12, 460.723) +effect = "powerup" + +[node name="CollisionShape2D" type="CollisionShape2D" parent="triggers/powerup"] +position = Vector2(0, -13) +shape = SubResource("RectangleShape2D_ape5f") +debug_color = Color(0.644817, 0.359472, 0.952285, 0.42) diff --git a/februarygodotgame/scenes/player.tscn b/februarygodotgame/scenes/player.tscn index c3a3691..0ae8e65 100644 --- a/februarygodotgame/scenes/player.tscn +++ b/februarygodotgame/scenes/player.tscn @@ -1,9 +1,177 @@ -[gd_scene load_steps=3 format=3 uid="uid://du8aftivw4k25"] +[gd_scene load_steps=28 format=3 uid="uid://du8aftivw4k25"] [ext_resource type="Script" path="res://scripts/player.gd" id="1_p8gev"] +[ext_resource type="Texture2D" uid="uid://70imyp6vsgvv" path="res://assets/graphics/player/idle/Player Idle 48x48.png" id="2_vqtu4"] +[ext_resource type="Texture2D" uid="uid://5ger8sg6iqqm" path="res://assets/graphics/player/jump/player jump 48x48(1).png" id="3_k55ht"] +[ext_resource type="Texture2D" uid="uid://crd320y5xhgwf" path="res://assets/graphics/player/run/player run 48x48(1).png" id="3_olacu"] [sub_resource type="CircleShape2D" id="CircleShape2D_a75m4"] +[sub_resource type="AtlasTexture" id="AtlasTexture_lxsaf"] +atlas = ExtResource("2_vqtu4") +region = Rect2(0, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_nc8f5"] +atlas = ExtResource("2_vqtu4") +region = Rect2(48, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_8t17o"] +atlas = ExtResource("2_vqtu4") +region = Rect2(96, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_un46h"] +atlas = ExtResource("2_vqtu4") +region = Rect2(144, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_yyi6q"] +atlas = ExtResource("2_vqtu4") +region = Rect2(192, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_e17dv"] +atlas = ExtResource("2_vqtu4") +region = Rect2(240, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_4i4mp"] +atlas = ExtResource("2_vqtu4") +region = Rect2(288, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_g1pat"] +atlas = ExtResource("2_vqtu4") +region = Rect2(336, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_udrwm"] +atlas = ExtResource("2_vqtu4") +region = Rect2(384, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_64ecg"] +atlas = ExtResource("2_vqtu4") +region = Rect2(432, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_0w8hc"] +atlas = ExtResource("3_k55ht") +region = Rect2(0, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_gnkqd"] +atlas = ExtResource("3_k55ht") +region = Rect2(48, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_xblxa"] +atlas = ExtResource("3_k55ht") +region = Rect2(96, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_14w4b"] +atlas = ExtResource("3_olacu") +region = Rect2(0, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ed7pw"] +atlas = ExtResource("3_olacu") +region = Rect2(48, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_bf8mn"] +atlas = ExtResource("3_olacu") +region = Rect2(96, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_3jaw1"] +atlas = ExtResource("3_olacu") +region = Rect2(144, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_nfpx8"] +atlas = ExtResource("3_olacu") +region = Rect2(192, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_vv4dg"] +atlas = ExtResource("3_olacu") +region = Rect2(240, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_pevx6"] +atlas = ExtResource("3_olacu") +region = Rect2(288, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ytupl"] +atlas = ExtResource("3_olacu") +region = Rect2(336, 0, 48, 48) + +[sub_resource type="SpriteFrames" id="SpriteFrames_upnp5"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_lxsaf") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_nc8f5") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_8t17o") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_un46h") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_yyi6q") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_e17dv") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_4i4mp") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_g1pat") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_udrwm") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_64ecg") +}], +"loop": true, +"name": &"idle", +"speed": 12.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_0w8hc") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_gnkqd") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_xblxa") +}], +"loop": false, +"name": &"jump", +"speed": 9.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_14w4b") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ed7pw") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_bf8mn") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_3jaw1") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_nfpx8") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_vv4dg") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_pevx6") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ytupl") +}], +"loop": true, +"name": &"run", +"speed": 12.0 +}] + [node name="CharacterBody2D" type="CharacterBody2D"] script = ExtResource("1_p8gev") metadata/_edit_group_ = true @@ -23,3 +191,14 @@ position = Vector2(11, -10) [node name="leftTarget" type="Node2D" parent="."] position = Vector2(-15, -10) + +[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] +texture_filter = 1 +position = Vector2(0, -7) +sprite_frames = SubResource("SpriteFrames_upnp5") +animation = &"jump" +autoplay = "jump" +frame = 2 +frame_progress = 1.0 + +[node name="Camera2D" type="Camera2D" parent="."] diff --git a/februarygodotgame/scenes/trigger.tscn b/februarygodotgame/scenes/trigger.tscn new file mode 100644 index 0000000..cfc283d --- /dev/null +++ b/februarygodotgame/scenes/trigger.tscn @@ -0,0 +1,9 @@ +[gd_scene load_steps=2 format=3 uid="uid://dgos05617rcuq"] + +[ext_resource type="Script" path="res://scripts/trigger.gd" id="1_3piuk"] + +[node name="Trigger" type="Area2D"] +script = ExtResource("1_3piuk") +metadata/_edit_group_ = true + +[connection signal="body_entered" from="." to="." method="_on_body_entered"] diff --git a/februarygodotgame/scripts/bullet.gd b/februarygodotgame/scripts/bullet.gd index 6091f3e..2a7bfe3 100644 --- a/februarygodotgame/scripts/bullet.gd +++ b/februarygodotgame/scripts/bullet.gd @@ -1,4 +1,5 @@ class_name Bullet extends Area2D +@onready var bulletGraphic: Sprite2D = $Sprite2D var speed = 750 @@ -6,7 +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: position += transform.x * speed * delta @@ -14,4 +18,5 @@ func _physics_process(delta: float) -> void: func _on_body_entered(body: Node2D) -> void: print ("bullet collision") - hit.emit(self, body) + if not body is Player: + hit.emit(self, body) diff --git a/februarygodotgame/scripts/crate.gd b/februarygodotgame/scripts/crate.gd new file mode 100644 index 0000000..7f42195 --- /dev/null +++ b/februarygodotgame/scripts/crate.gd @@ -0,0 +1 @@ +class_name Crate extends RigidBody2D diff --git a/februarygodotgame/scripts/gamecontroller.gd b/februarygodotgame/scripts/gamecontroller.gd index 5ec63d4..3c35e8c 100644 --- a/februarygodotgame/scripts/gamecontroller.gd +++ b/februarygodotgame/scripts/gamecontroller.gd @@ -1,4 +1,4 @@ -extends Node2D +class_name GameController extends Node2D #Game Data var totalCrates = 2 @@ -14,12 +14,27 @@ 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("you won") +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": + if body is Player: + print("power up the player") + +func bulletHit(body): + print("Game controller knows bullet hit") + if body is Crate: + print("You hit a Crate") + cratesDestroyed +=1 + %SceneManager.destroy(body) + print("Crates Remaining :: "+str(totalCrates - cratesDestroyed)) + +func numberOfCrates(value): + totalCrates = value + print("Game Controller knows crates "+str(totalCrates)) diff --git a/februarygodotgame/scripts/player.gd b/februarygodotgame/scripts/player.gd index d8e62ea..ed3446a 100644 --- a/februarygodotgame/scripts/player.gd +++ b/februarygodotgame/scripts/player.gd @@ -1,4 +1,5 @@ -extends CharacterBody2D +class_name Player extends CharacterBody2D +@onready var playerGraphic: AnimatedSprite2D = $AnimatedSprite2D const SPEED = 300.0 @@ -9,22 +10,26 @@ var faceLeft = false var pushRightEnabled = false var pushLeftEnabled = false var pushTarget +var isJumping = false @onready var rightcast: RayCast2D = $rightcast @onready var leftcast: RayCast2D = $leftcast @onready var right_target: Node2D = $rightTarget @onready var left_target: Node2D = $leftTarget - 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. var direction := Input.get_axis("left", "right") @@ -46,10 +51,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() if rightcast.is_colliding(): diff --git a/februarygodotgame/scripts/scene_manager.gd b/februarygodotgame/scripts/scene_manager.gd index 3a2a1bc..a1f31e0 100644 --- a/februarygodotgame/scripts/scene_manager.gd +++ b/februarygodotgame/scripts/scene_manager.gd @@ -1,4 +1,8 @@ extends Node +@onready var gameController: Node2D = $".." +@onready var crates: Node2D = $"../crates" +@onready var triggers: Node2D = $"../triggers" + var bulletsFiredTotal = 0 var bulletsMadeTotal = 0 @@ -26,5 +30,29 @@ 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 something") + 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/februarygodotgame/scripts/trigger.gd b/februarygodotgame/scripts/trigger.gd index 6b4df2c..d1a0bcf 100644 --- a/februarygodotgame/scripts/trigger.gd +++ b/februarygodotgame/scripts/trigger.gd @@ -1,6 +1,7 @@ -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 here") @@ -13,4 +14,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)