diff --git a/indigogameone/.DS_Store b/indigogameone/.DS_Store index d1da8a4..7b26466 100644 Binary files a/indigogameone/.DS_Store and b/indigogameone/.DS_Store differ diff --git a/indigogameone/assets/graphics/environment/Terrain (32x32).png b/indigogameone/assets/graphics/environment/Terrain (32x32).png new file mode 100644 index 0000000..ddf1eaf Binary files /dev/null and b/indigogameone/assets/graphics/environment/Terrain (32x32).png differ diff --git a/indigogameone/assets/graphics/environment/Terrain (32x32).png.import b/indigogameone/assets/graphics/environment/Terrain (32x32).png.import new file mode 100644 index 0000000..a26c459 --- /dev/null +++ b/indigogameone/assets/graphics/environment/Terrain (32x32).png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://5ab70owk0cn7" +path="res://.godot/imported/Terrain (32x32).png-9865738cd415cdc1d530801f96959643.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/environment/Terrain (32x32).png" +dest_files=["res://.godot/imported/Terrain (32x32).png-9865738cd415cdc1d530801f96959643.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/indigogameone/assets/graphics/objects/crate.png b/indigogameone/assets/graphics/objects/crate.png new file mode 100644 index 0000000..2b8bdcd Binary files /dev/null and b/indigogameone/assets/graphics/objects/crate.png differ diff --git a/indigogameone/assets/graphics/objects/crate.png.import b/indigogameone/assets/graphics/objects/crate.png.import new file mode 100644 index 0000000..183ba77 --- /dev/null +++ b/indigogameone/assets/graphics/objects/crate.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://byw1vqghqcgp2" +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/indigogameone/assets/graphics/pixel_bullet.png b/indigogameone/assets/graphics/pixel_bullet.png new file mode 100644 index 0000000..900d030 Binary files /dev/null and b/indigogameone/assets/graphics/pixel_bullet.png differ diff --git a/indigogameone/assets/graphics/pixel_bullet.png.import b/indigogameone/assets/graphics/pixel_bullet.png.import new file mode 100644 index 0000000..a285d5e --- /dev/null +++ b/indigogameone/assets/graphics/pixel_bullet.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://4ry7j22utcml" +path="res://.godot/imported/pixel_bullet.png-a3a9722872bd6e22bf814eab1fd8d87d.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/pixel_bullet.png" +dest_files=["res://.godot/imported/pixel_bullet.png-a3a9722872bd6e22bf814eab1fd8d87d.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/indigogameone/assets/graphics/player/idle/Player Idle 48x48.png b/indigogameone/assets/graphics/player/idle/Player Idle 48x48.png new file mode 100644 index 0000000..b618511 Binary files /dev/null and b/indigogameone/assets/graphics/player/idle/Player Idle 48x48.png differ diff --git a/indigogameone/assets/graphics/player/idle/Player Idle 48x48.png.import b/indigogameone/assets/graphics/player/idle/Player Idle 48x48.png.import new file mode 100644 index 0000000..f5f26ae --- /dev/null +++ b/indigogameone/assets/graphics/player/idle/Player Idle 48x48.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b4vx6usqxle4j" +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/indigogameone/assets/graphics/player/jump/player jump 48x48.png b/indigogameone/assets/graphics/player/jump/player jump 48x48.png new file mode 100644 index 0000000..dff105c Binary files /dev/null and b/indigogameone/assets/graphics/player/jump/player jump 48x48.png differ diff --git a/indigogameone/assets/graphics/player/jump/player jump 48x48.png.import b/indigogameone/assets/graphics/player/jump/player jump 48x48.png.import new file mode 100644 index 0000000..40f1cca --- /dev/null +++ b/indigogameone/assets/graphics/player/jump/player jump 48x48.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://y5mb7anm4sgh" +path="res://.godot/imported/player jump 48x48.png-1ccba0c36041038682bf917e1f6cf991.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-1ccba0c36041038682bf917e1f6cf991.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/indigogameone/assets/graphics/player/run/player run 48x48.png b/indigogameone/assets/graphics/player/run/player run 48x48.png new file mode 100644 index 0000000..aca5b55 Binary files /dev/null and b/indigogameone/assets/graphics/player/run/player run 48x48.png differ diff --git a/indigogameone/assets/graphics/player/run/player run 48x48.png.import b/indigogameone/assets/graphics/player/run/player run 48x48.png.import new file mode 100644 index 0000000..b27be50 --- /dev/null +++ b/indigogameone/assets/graphics/player/run/player run 48x48.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://by308sw7sj17r" +path="res://.godot/imported/player run 48x48.png-6d66612d48bfa4c8721495ba557ab7c6.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-6d66612d48bfa4c8721495ba557ab7c6.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/indigogameone/project.godot b/indigogameone/project.godot index 8f00343..327d659 100644 --- a/indigogameone/project.godot +++ b/indigogameone/project.godot @@ -15,6 +15,13 @@ run/main_scene="res://scenes/game.tscn" config/features=PackedStringArray("4.3", "Forward Plus") config/icon="res://icon.svg" +[file_customization] + +folder_colors={ +"res://assets/graphics/": "red", +"res://assets/graphics/objects/": "red" +} + [input] Shove={ diff --git a/indigogameone/scenes/bullets.tscn b/indigogameone/scenes/bullets.tscn index d184b34..ccd9029 100644 --- a/indigogameone/scenes/bullets.tscn +++ b/indigogameone/scenes/bullets.tscn @@ -1,16 +1,22 @@ -[gd_scene load_steps=3 format=3 uid="uid://ctn52om1wdpb5"] +[gd_scene load_steps=4 format=3 uid="uid://ctn52om1wdpb5"] [ext_resource type="Script" path="res://scripts/bullet.gd" id="1_5y5v0"] +[ext_resource type="Texture2D" uid="uid://4ry7j22utcml" path="res://assets/graphics/pixel_bullet.png" id="2_kqndj"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_qu5ok"] size = Vector2(20, 4) [node name="Area2D" type="Area2D"] script = ExtResource("1_5y5v0") -metadata/_edit_group_ = true [node name="CollisionShape2D" type="CollisionShape2D" parent="."] shape = SubResource("RectangleShape2D_qu5ok") debug_color = Color(0, 0.909804, 0.541176, 0.419608) +[node name="Sprite2D" type="Sprite2D" parent="."] +position = Vector2(-14, -13) +rotation = 3.11816 +scale = Vector2(0.505787, 0.505787) +texture = ExtResource("2_kqndj") + [connection signal="body_entered" from="." to="." method="_on_body_entered"] diff --git a/indigogameone/scenes/crate.tscn b/indigogameone/scenes/crate.tscn index 3f859ff..6665636 100644 --- a/indigogameone/scenes/crate.tscn +++ b/indigogameone/scenes/crate.tscn @@ -1,4 +1,6 @@ -[gd_scene load_steps=2 format=3 uid="uid://d4lcu5l7nqd2f"] +[gd_scene load_steps=3 format=3 uid="uid://d4lcu5l7nqd2f"] + +[ext_resource type="Texture2D" uid="uid://byw1vqghqcgp2" path="res://assets/graphics/objects/crate.png" id="1_m3hm8"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_51x3g"] @@ -10,3 +12,8 @@ metadata/_edit_group_ = true [node name="CollisionShape2D" type="CollisionShape2D" parent="."] shape = SubResource("RectangleShape2D_51x3g") debug_color = Color(0.819608, 0.447059, 0.654902, 0.643137) + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture_filter = 1 +scale = Vector2(0.188724, 0.188724) +texture = ExtResource("1_m3hm8") diff --git a/indigogameone/scenes/game.tscn b/indigogameone/scenes/game.tscn index f0e3c74..837a131 100644 --- a/indigogameone/scenes/game.tscn +++ b/indigogameone/scenes/game.tscn @@ -1,9 +1,66 @@ -[gd_scene load_steps=6 format=3 uid="uid://bpvxf6b1pgvw1"] +[gd_scene load_steps=10 format=4 uid="uid://bpvxf6b1pgvw1"] [ext_resource type="PackedScene" uid="uid://d4lcu5l7nqd2f" path="res://scenes/crate.tscn" id="1_5062r"] [ext_resource type="PackedScene" uid="uid://b06r6vtllw0b7" path="res://scenes/player.tscn" id="1_fdutd"] +[ext_resource type="Script" path="res://scenes/scene_manager.gd" id="1_u3qrg"] +[ext_resource type="Texture2D" uid="uid://5ab70owk0cn7" path="res://assets/graphics/environment/Terrain (32x32).png" id="2_w2wc2"] [ext_resource type="PackedScene" uid="uid://ckvtpjm5q2t0d" path="res://scenes/trigger.tscn" id="3_bhtcy"] +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_uttar"] +texture = ExtResource("2_w2wc2") +texture_region_size = Vector2i(32, 32) +0:0/0 = 0 +1:0/0 = 0 +2:0/0 = 0 +4:0/0 = 0 +6:0/0 = 0 +7:0/0 = 0 +9:0/0 = 0 +10:0/0 = 0 +12:0/0 = 0 +13:0/0 = 0 +15:0/0 = 0 +0:1/0 = 0 +1:1/0 = 0 +2:1/0 = 0 +4:1/0 = 0 +6:1/0 = 0 +7:1/0 = 0 +9:1/0 = 0 +10:1/0 = 0 +12:1/0 = 0 +13:1/0 = 0 +15:1/0 = 0 +16:1/0 = 0 +0:2/0 = 0 +1:2/0 = 0 +2:2/0 = 0 +4:2/0 = 0 +6:3/0 = 0 +7:3/0 = 0 +9:3/0 = 0 +10:3/0 = 0 +12:3/0 = 0 +13:3/0 = 0 +15:3/0 = 0 +16:3/0 = 0 +0:4/0 = 0 +1:4/0 = 0 +2:4/0 = 0 +4:4/0 = 0 +6:4/0 = 0 +7:4/0 = 0 +9:4/0 = 0 +10:4/0 = 0 +12:4/0 = 0 +13:4/0 = 0 +15:4/0 = 0 +16:4/0 = 0 + +[sub_resource type="TileSet" id="TileSet_qu0u3"] +tile_size = Vector2i(32, 32) +sources/0 = SubResource("TileSetAtlasSource_uttar") + [sub_resource type="RectangleShape2D" id="RectangleShape2D_by4gc"] size = Vector2(25.75, 20) @@ -11,6 +68,15 @@ size = Vector2(25.75, 20) [node name="World" type="Node2D"] +[node name="SceneManager" type="Node" parent="."] +unique_name_in_owner = true +script = ExtResource("1_u3qrg") + +[node name="TileMapLayer" type="TileMapLayer" parent="."] +position = Vector2(3, 0) +tile_map_data = PackedByteArray("AAAHAAgAAAAAAAAAAAAIAAgAAAAAAAAAAAAJAAgAAAAAAAAAAAAKAAgAAAAAAAAAAAALAAgAAAAAAAAAAAAMAAgAAAAAAAAAAAALAAYAAAAEAAQAAAAMAAoAAAAAAAQAAAANAAoAAAABAAQAAAAOAAoAAAACAAQAAAAPAAoAAAAAAAQAAAAQAAoAAAABAAQAAAARAAoAAAACAAQAAAAUAA4AAAAAAAQAAAAVAA4AAAABAAQAAAAWAA4AAAACAAQAAAAQAAwAAAAAAAQAAAARAAwAAAABAAQAAAASAAwAAAACAAQAAAAFAAoAAAAEAAQAAAADAAwAAAAEAAQAAAABAA4AAAAEAAQAAAA=") +tile_set = SubResource("TileSet_qu0u3") + [node name="platform" type="StaticBody2D" parent="."] position = Vector2(373, 218) metadata/_edit_group_ = true @@ -34,6 +100,34 @@ metadata/_edit_group_ = true [node name="CollisionShape2D" type="CollisionShape2D" parent="platform3"] shape = SubResource("RectangleShape2D_by4gc") +[node name="platform4" type="StaticBody2D" parent="."] +position = Vector2(604, 401) +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="platform4"] +shape = SubResource("RectangleShape2D_by4gc") + +[node name="platform5" type="StaticBody2D" parent="."] +position = Vector2(179, 336) +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="platform5"] +shape = SubResource("RectangleShape2D_by4gc") + +[node name="platform6" type="StaticBody2D" parent="."] +position = Vector2(115, 402) +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="platform6"] +shape = SubResource("RectangleShape2D_by4gc") + +[node name="platform7" type="StaticBody2D" parent="."] +position = Vector2(51, 465) +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="platform7"] +shape = SubResource("RectangleShape2D_by4gc") + [node name="Floor" type="StaticBody2D" parent="."] position = Vector2(558, 525) metadata/_edit_group_ = true @@ -41,9 +135,11 @@ metadata/_edit_group_ = true [node name="CollisionShape2D" type="CollisionShape2D" parent="Floor"] shape = SubResource("WorldBoundaryShape2D_7qxn5") -[node name="CharacterBody2D" parent="." instance=ExtResource("1_fdutd")] +[node name="CharacterBody2D" parent="." groups=["player"] instance=ExtResource("1_fdutd")] rotation = -0.00098838 +[node name="Camera2D" type="Camera2D" parent="CharacterBody2D"] + [node name="Area2D" parent="." instance=ExtResource("3_bhtcy")] [node name="RigidBody2D" parent="." groups=["pushables"] instance=ExtResource("1_5062r")] @@ -54,3 +150,9 @@ position = Vector2(453, 166) [node name="RigidBody2D3" parent="." groups=["pushables"] instance=ExtResource("1_5062r")] position = Vector2(605, 250) + +[node name="RigidBody2D4" parent="." groups=["pushables"] instance=ExtResource("1_5062r")] +position = Vector2(310, 143) + +[node name="BoxTrapTarget" type="Node2D" parent="."] +position = Vector2(110, 146) diff --git a/indigogameone/scenes/player.tscn b/indigogameone/scenes/player.tscn index a54b7a7..65d7879 100644 --- a/indigogameone/scenes/player.tscn +++ b/indigogameone/scenes/player.tscn @@ -1,6 +1,174 @@ -[gd_scene load_steps=3 format=3 uid="uid://b06r6vtllw0b7"] +[gd_scene load_steps=28 format=3 uid="uid://b06r6vtllw0b7"] [ext_resource type="Script" path="res://scripts/player.gd" id="1_5gbgu"] +[ext_resource type="Texture2D" uid="uid://b4vx6usqxle4j" path="res://assets/graphics/player/idle/Player Idle 48x48.png" id="2_38vxs"] +[ext_resource type="Texture2D" uid="uid://y5mb7anm4sgh" path="res://assets/graphics/player/jump/player jump 48x48.png" id="3_coupp"] +[ext_resource type="Texture2D" uid="uid://by308sw7sj17r" path="res://assets/graphics/player/run/player run 48x48.png" id="3_mjo1k"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_alqpc"] +atlas = ExtResource("2_38vxs") +region = Rect2(0, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_l14j5"] +atlas = ExtResource("2_38vxs") +region = Rect2(48, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_yahyo"] +atlas = ExtResource("2_38vxs") +region = Rect2(96, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ioiuo"] +atlas = ExtResource("2_38vxs") +region = Rect2(144, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_kwwhi"] +atlas = ExtResource("2_38vxs") +region = Rect2(192, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_dnyv4"] +atlas = ExtResource("2_38vxs") +region = Rect2(240, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_7jb1d"] +atlas = ExtResource("2_38vxs") +region = Rect2(288, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_7juuh"] +atlas = ExtResource("2_38vxs") +region = Rect2(336, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_c1iri"] +atlas = ExtResource("2_38vxs") +region = Rect2(384, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_7cw7d"] +atlas = ExtResource("2_38vxs") +region = Rect2(432, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_onski"] +atlas = ExtResource("3_coupp") +region = Rect2(0, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_njipa"] +atlas = ExtResource("3_coupp") +region = Rect2(48, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_jnruv"] +atlas = ExtResource("3_coupp") +region = Rect2(96, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_etrer"] +atlas = ExtResource("3_mjo1k") +region = Rect2(0, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_j2dlj"] +atlas = ExtResource("3_mjo1k") +region = Rect2(48, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_cuybg"] +atlas = ExtResource("3_mjo1k") +region = Rect2(96, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_1oq7j"] +atlas = ExtResource("3_mjo1k") +region = Rect2(144, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_tw0l5"] +atlas = ExtResource("3_mjo1k") +region = Rect2(192, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_dapjm"] +atlas = ExtResource("3_mjo1k") +region = Rect2(240, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_f7yjm"] +atlas = ExtResource("3_mjo1k") +region = Rect2(288, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_vat2j"] +atlas = ExtResource("3_mjo1k") +region = Rect2(336, 0, 48, 48) + +[sub_resource type="SpriteFrames" id="SpriteFrames_nfvt1"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_alqpc") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_l14j5") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_yahyo") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ioiuo") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_kwwhi") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_dnyv4") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_7jb1d") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_7juuh") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_c1iri") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_7cw7d") +}], +"loop": true, +"name": &"idle", +"speed": 15.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_onski") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_njipa") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_jnruv") +}], +"loop": false, +"name": &"jump", +"speed": 9.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_etrer") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_j2dlj") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_cuybg") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_1oq7j") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_tw0l5") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_dapjm") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_f7yjm") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_vat2j") +}], +"loop": true, +"name": &"run", +"speed": 15.0 +}] [sub_resource type="CircleShape2D" id="CircleShape2D_gwwau"] @@ -8,6 +176,14 @@ script = ExtResource("1_5gbgu") metadata/_edit_group_ = true +[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] +texture_filter = 1 +position = Vector2(4, -42) +scale = Vector2(3.20833, 3.20833) +sprite_frames = SubResource("SpriteFrames_nfvt1") +animation = &"jump" +autoplay = "idle" + [node name="CollisionShape2D" type="CollisionShape2D" parent="."] shape = SubResource("CircleShape2D_gwwau") debug_color = Color(0.858824, 0.227451, 0.4, 0.909804) diff --git a/indigogameone/scenes/scene_manager.gd b/indigogameone/scenes/scene_manager.gd new file mode 100644 index 0000000..b3a13de --- /dev/null +++ b/indigogameone/scenes/scene_manager.gd @@ -0,0 +1,51 @@ +extends Node +var crate = preload("res://scenes/crate.tscn") +var bullet = preload("res://scenes/bullets.tscn") +# Called when the node enters the scene tree for the first time. +var bulletPool:Array = [] #start off with it empty; no bullets +#crate stuff +var cratePool:Array = [] +@onready var box_trap_target: Node2D = $"../BoxTrapTarget" + +#called when the node enters the scene tree fro the first time +func _ready() -> void: #function that runs exactly run time.. safe place to do any configurations there + #pool all the crates + for obj in owner.get_children(): + if obj.is_in_group("pushables"): + cratePool.push_back(obj) + print("Total crates on screen: "+str(cratePool.size())) + +func boxTrap(): + print("Trigger a box trap!") + var myCrate= crateFactory() #gonna ask factory for our crate + myCrate.transform = box_trap_target.transform + owner.add_child(myCrate) + +func bulletFactory(): + #makes bullets! + var myBullet + print("total bullets in play "+str(bulletPool.size())) + if bulletPool.size() > 3: + myBullet = bulletPool.pop_front() #if you got 3 bullets in play already, gonna take oldest bullet in pool and give you that + else: + myBullet = bullet.instantiate() + owner.add_child(myBullet) + #or recycles bullets + return myBullet + +func placeBullet(speed, markerpos): + print("SceneManager: make a bullet") + var myBullet = bulletFactory() + bulletPool.push_back(myBullet) #everytime we ask for bullet it gonna be added to the pool + print("Total bullets in play: "+str(bulletPool.size())) + #set the speed of the bullet + myBullet.setSpeed(speed) + #set of position of the bullet + myBullet.transform = markerpos + #make the bullet visible by adding it + +func crateFactory(): + var myCrate = crate.instantiate() + myCrate.add_to_group("pushables") + return myCrate + diff --git a/indigogameone/scripts/bullet.gd b/indigogameone/scripts/bullet.gd index 4899c16..d8192b2 100644 --- a/indigogameone/scripts/bullet.gd +++ b/indigogameone/scripts/bullet.gd @@ -1,4 +1,5 @@ extends Area2D +@onready var bulletsprite: Sprite2D = $Sprite2D var speed := 700 #implied type colon equal it looks at what you're trying to store in memory and put similar things together which is much faster for your operating system to process signal hit(bullet, body) @@ -7,6 +8,10 @@ signal hit(bullet, body) func setSpeed(speedVal): #by default will be 700, but can change here if we want speed = speedVal + if speedVal < 0: + bulletsprite.flip_h = true + else: + bulletsprite.flip_h = false func _physics_process(delta: float) -> void: position += transform.x * speed * delta diff --git a/indigogameone/scripts/player.gd b/indigogameone/scripts/player.gd index 1bfc99b..1f8bb97 100644 --- a/indigogameone/scripts/player.gd +++ b/indigogameone/scripts/player.gd @@ -13,6 +13,8 @@ var pushRightEnabled = false @onready var left_ray: RayCast2D = $LeftRay @onready var marker_right: Node2D = $MarkerRight @onready var marker_left: Node2D = $MarkerLeft +@onready var playerSprite: AnimatedSprite2D = $AnimatedSprite2D + var pushTarget @@ -42,19 +44,22 @@ func _physics_process(delta: float) -> void: pushRightEnabled = false if Input.is_action_just_pressed("shoot"): - print("I will shoot") + var mybullet = bullet.instantiate() #will make bullet but won't position or put bullet on screen if faceLeft: print("shoot left") - mybullet.setSpeed(-700) - mybullet.transform = marker_left.global_transform + #mybullet.setSpeed(-700) + #mybullet.transform = marker_left.global_transform + %SceneManager.placeBullet(-700, marker_left.global_transform) else: print("shoot right") #position bullet - mybullet.transform = marker_right.global_transform #saying give me global coordinates for .. + #mybullet.transform = marker_right.global_transform #saying give me global coordinates for .. #put bullet on screen - owner.add_child(mybullet) #adds bullet when facing both directions + #owner.add_child(mybullet) #adds bullet when facing both directions + #saying place bullet in global coordinates not local + %SceneManager.placeBullet(700, marker_right.global_transform) # Get the input direction and handle the movement/deceleration. # As good practice, you should replace UI actions with custom gameplay actions. @@ -62,12 +67,24 @@ func _physics_process(delta: float) -> void: #code tells us whether we are facing left or right if direction <0: faceLeft = true + playerSprite.flip_h = true if direction >0: faceLeft = false + playerSprite.flip_h = false + if direction: velocity.x = direction * SPEED else: velocity.x = move_toward(velocity.x, 0, SPEED) + + if is_on_floor(): + #looks at angle to see if flat surface or if surface is wall... 45 deg angle is floor + if direction == 0: + playerSprite.play("idle") + else: + playerSprite.play("run") + else: + playerSprite.play("jump") #blue text is part of the engine!!!! move_and_slide() #this is where all the collisions are recorded for i in get_slide_collision_count(): diff --git a/indigogameone/scripts/trigger.gd b/indigogameone/scripts/trigger.gd index b630d2f..d865daa 100644 --- a/indigogameone/scripts/trigger.gd +++ b/indigogameone/scripts/trigger.gd @@ -13,6 +13,9 @@ func _process(delta: float) -> void: func _on_body_entered(body: Node2D) -> void: print("Trigger is fired") + if body.is_in_group("player"): + print("player entered the trap!") + %SceneManager.boxTrap() func _on_body_exited(body: Node2D) -> void: