diff --git a/februarygodotgame/assets/graphics/enemies/slime_green.png b/februarygodotgame/assets/graphics/enemies/slime_green.png new file mode 100644 index 0000000..a21cb6f Binary files /dev/null and b/februarygodotgame/assets/graphics/enemies/slime_green.png differ diff --git a/februarygodotgame/assets/graphics/enemies/slime_green.png.import b/februarygodotgame/assets/graphics/enemies/slime_green.png.import new file mode 100644 index 0000000..c6ce784 --- /dev/null +++ b/februarygodotgame/assets/graphics/enemies/slime_green.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://gm75hmen7j50" +path="res://.godot/imported/slime_green.png-5261ffd1254c816fe62b35227a9aa11d.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/enemies/slime_green.png" +dest_files=["res://.godot/imported/slime_green.png-5261ffd1254c816fe62b35227a9aa11d.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/pickups/coin.png b/februarygodotgame/assets/graphics/pickups/coin.png new file mode 100644 index 0000000..01ae33d Binary files /dev/null and b/februarygodotgame/assets/graphics/pickups/coin.png differ diff --git a/februarygodotgame/assets/graphics/pickups/coin.png.import b/februarygodotgame/assets/graphics/pickups/coin.png.import new file mode 100644 index 0000000..7270346 --- /dev/null +++ b/februarygodotgame/assets/graphics/pickups/coin.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b8vlyhcglefuj" +path="res://.godot/imported/coin.png-f0b33289d8d72c34d5a0c76da4c0f19c.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/pickups/coin.png" +dest_files=["res://.godot/imported/coin.png-f0b33289d8d72c34d5a0c76da4c0f19c.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/hurt/Player Hurt 48x48.png b/februarygodotgame/assets/graphics/player/hurt/Player Hurt 48x48.png new file mode 100644 index 0000000..57d8783 Binary files /dev/null and b/februarygodotgame/assets/graphics/player/hurt/Player Hurt 48x48.png differ diff --git a/februarygodotgame/assets/graphics/player/hurt/Player Hurt 48x48.png.import b/februarygodotgame/assets/graphics/player/hurt/Player Hurt 48x48.png.import new file mode 100644 index 0000000..2d927b4 --- /dev/null +++ b/februarygodotgame/assets/graphics/player/hurt/Player Hurt 48x48.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c8seclaqrgq6x" +path="res://.godot/imported/Player Hurt 48x48.png-a720e51cb19103e76b22ab6c1b81302d.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/player/hurt/Player Hurt 48x48.png" +dest_files=["res://.godot/imported/Player Hurt 48x48.png-a720e51cb19103e76b22ab6c1b81302d.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 e57c21b..2d83921 100644 --- a/februarygodotgame/project.godot +++ b/februarygodotgame/project.godot @@ -15,6 +15,10 @@ run/main_scene="res://scenes/game.tscn" config/features=PackedStringArray("4.3", "Forward Plus") config/icon="res://icon.svg" +[autoload] + +Gamecontroller="*res://scripts/gamecontroller.gd" + [display] window/size/viewport_width=320 diff --git a/februarygodotgame/scenes/coin.tscn b/februarygodotgame/scenes/coin.tscn new file mode 100644 index 0000000..4273054 --- /dev/null +++ b/februarygodotgame/scenes/coin.tscn @@ -0,0 +1,114 @@ +[gd_scene load_steps=17 format=3 uid="uid://meryvmptc54n"] + +[ext_resource type="Texture2D" uid="uid://b8vlyhcglefuj" path="res://assets/graphics/pickups/coin.png" id="1_abrt3"] +[ext_resource type="Script" path="res://scripts/coin.gd" id="1_ls8t6"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_b03k4"] +atlas = ExtResource("1_abrt3") +region = Rect2(0, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_1skvc"] +atlas = ExtResource("1_abrt3") +region = Rect2(16, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_x45yo"] +atlas = ExtResource("1_abrt3") +region = Rect2(32, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_triro"] +atlas = ExtResource("1_abrt3") +region = Rect2(48, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_6hrn2"] +atlas = ExtResource("1_abrt3") +region = Rect2(64, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_fpiug"] +atlas = ExtResource("1_abrt3") +region = Rect2(80, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_mhtbw"] +atlas = ExtResource("1_abrt3") +region = Rect2(96, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ydt7y"] +atlas = ExtResource("1_abrt3") +region = Rect2(112, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_5fdw4"] +atlas = ExtResource("1_abrt3") +region = Rect2(128, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_l01r1"] +atlas = ExtResource("1_abrt3") +region = Rect2(144, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_prywm"] +atlas = ExtResource("1_abrt3") +region = Rect2(160, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_laboj"] +atlas = ExtResource("1_abrt3") +region = Rect2(176, 0, 16, 16) + +[sub_resource type="SpriteFrames" id="SpriteFrames_uqmok"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_b03k4") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_1skvc") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_x45yo") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_triro") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_6hrn2") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_fpiug") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_mhtbw") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ydt7y") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_5fdw4") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_l01r1") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_prywm") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_laboj") +}], +"loop": true, +"name": &"default", +"speed": 12.0 +}] + +[sub_resource type="CircleShape2D" id="CircleShape2D_fkwcj"] +radius = 5.0 + +[node name="Area2D" type="Area2D"] +script = ExtResource("1_ls8t6") + +[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] +texture_filter = 1 +sprite_frames = SubResource("SpriteFrames_uqmok") +autoplay = "default" +frame = 2 +frame_progress = 0.0287075 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource("CircleShape2D_fkwcj") + +[connection signal="body_entered" from="." to="." method="_on_body_entered"] diff --git a/februarygodotgame/scenes/game.tscn b/februarygodotgame/scenes/game.tscn index 66b44a0..37356d6 100644 --- a/februarygodotgame/scenes/game.tscn +++ b/februarygodotgame/scenes/game.tscn @@ -1,6 +1,5 @@ -[gd_scene load_steps=22 format=4 uid="uid://bt6uaac8wfn8k"] +[gd_scene load_steps=23 format=4 uid="uid://bt6uaac8wfn8k"] -[ext_resource type="Script" path="res://scripts/gamecontroller.gd" id="1_wwyby"] [ext_resource type="Texture2D" uid="uid://b864327g3sfgt" path="res://assets/graphics/backgrounds/block.png" id="2_05t6n"] [ext_resource type="Texture2D" uid="uid://dceuefsnvb441" path="res://assets/graphics/terrains/Terrain (32x32) (1).png" id="2_k4vve"] [ext_resource type="PackedScene" uid="uid://bibqnht5dooss" path="res://scenes/trigger.tscn" id="2_psv8k"] @@ -13,6 +12,8 @@ [ext_resource type="Texture2D" uid="uid://bkmaqkvirjxs3" path="res://assets/graphics/backgrounds/rocks.png" id="5_4ta71"] [ext_resource type="Texture2D" uid="uid://bu6vmqioadmrh" path="res://assets/graphics/terrains/mushroom.png" id="5_7ribr"] [ext_resource type="Script" path="res://scripts/scene_manager.gd" id="5_xhw0f"] +[ext_resource type="PackedScene" uid="uid://meryvmptc54n" path="res://scenes/coin.tscn" id="13_vf7vr"] +[ext_resource type="PackedScene" uid="uid://c3blwnpwdol0a" path="res://scenes/slime.tscn" id="14_nv7k0"] [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_ud57a"] texture = ExtResource("2_k4vve") @@ -396,7 +397,6 @@ size = Vector2(72, 20) size = Vector2(20, 40) [node name="Game" type="Node2D"] -script = ExtResource("1_wwyby") [node name="sky" type="Parallax2D" parent="."] repeat_size = Vector2(320, 180) @@ -465,7 +465,7 @@ rotation = 0.380482 script = ExtResource("4_5sp5n") [node name="crate4" parent="crates" instance=ExtResource("3_ek1d4")] -position = Vector2(628, 345) +position = Vector2(683, 338) rotation = 0.380482 script = ExtResource("4_5sp5n") @@ -499,3 +499,19 @@ effect = "powerup" position = Vector2(0, -10) shape = SubResource("RectangleShape2D_1ymsv") debug_color = Color(0.156093, 0.622347, 0.484765, 0.42) + +[node name="coins" type="Node2D" parent="."] + +[node name="Area2D" parent="coins" instance=ExtResource("13_vf7vr")] +position = Vector2(616, 455) + +[node name="Area2D2" parent="coins" instance=ExtResource("13_vf7vr")] +position = Vector2(685, 411) + +[node name="Area2D3" parent="coins" instance=ExtResource("13_vf7vr")] +position = Vector2(814, 411) + +[node name="badguys" type="Node2D" parent="."] + +[node name="Area2D" parent="badguys" instance=ExtResource("14_nv7k0")] +position = Vector2(562, 469) diff --git a/februarygodotgame/scenes/level2.tscn b/februarygodotgame/scenes/level2.tscn index 2d849aa..cf9762b 100644 --- a/februarygodotgame/scenes/level2.tscn +++ b/februarygodotgame/scenes/level2.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=22 format=4 uid="uid://co82tvqhyrrdl"] +[gd_scene load_steps=22 format=4 uid="uid://bxnqbn4qfkh1y"] [ext_resource type="Script" path="res://scripts/gamecontroller.gd" id="1_hkovx"] [ext_resource type="Texture2D" uid="uid://b864327g3sfgt" path="res://assets/graphics/backgrounds/block.png" id="2_6yvgp"] diff --git a/februarygodotgame/scenes/level3.tscn b/februarygodotgame/scenes/level3.tscn new file mode 100644 index 0000000..12da5d4 --- /dev/null +++ b/februarygodotgame/scenes/level3.tscn @@ -0,0 +1,499 @@ +[gd_scene load_steps=21 format=4 uid="uid://cce26eq3etcdg"] + +[ext_resource type="Texture2D" uid="uid://b864327g3sfgt" path="res://assets/graphics/backgrounds/block.png" id="1_i0nwn"] +[ext_resource type="Texture2D" uid="uid://y3nls3jdessv" path="res://assets/graphics/backgrounds/forestbackground (2).png" id="2_6ftlp"] +[ext_resource type="Texture2D" uid="uid://cqsyqmn3x0krf" path="res://assets/graphics/backgrounds/shrubs.png" id="3_34sir"] +[ext_resource type="Texture2D" uid="uid://bkmaqkvirjxs3" path="res://assets/graphics/backgrounds/rocks.png" id="4_o62em"] +[ext_resource type="Texture2D" uid="uid://dceuefsnvb441" path="res://assets/graphics/terrains/Terrain (32x32) (1).png" id="5_aabh3"] +[ext_resource type="Texture2D" uid="uid://crulrkd4r5bln" path="res://assets/graphics/terrains/veg_32x32.png" id="6_06xm0"] +[ext_resource type="Texture2D" uid="uid://bu6vmqioadmrh" path="res://assets/graphics/terrains/mushroom.png" id="7_61gcb"] +[ext_resource type="PackedScene" uid="uid://celwbq1syhdoa" path="res://scenes/crate.tscn" id="8_4axuh"] +[ext_resource type="Script" path="res://scripts/crate.gd" id="9_jwr41"] +[ext_resource type="PackedScene" uid="uid://cjvyslsoa7olc" path="res://scenes/player.tscn" id="10_poa8t"] +[ext_resource type="Script" path="res://scripts/scene_manager.gd" id="11_lvxwe"] +[ext_resource type="PackedScene" uid="uid://bibqnht5dooss" path="res://scenes/trigger.tscn" id="12_527fi"] + +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_ud57a"] +texture = ExtResource("5_aabh3") +texture_region_size = Vector2i(32, 32) +0:0/0 = 0 +0:0/0/terrain_set = 0 +0:0/0/terrain = 0 +0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16) +0:0/0/terrains_peering_bit/right_side = 0 +0:0/0/terrains_peering_bit/bottom_right_corner = 0 +0:0/0/terrains_peering_bit/bottom_side = 0 +1:0/0 = 0 +1:0/0/terrain_set = 0 +1:0/0/terrain = 0 +1:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16) +1:0/0/terrains_peering_bit/right_side = 0 +1:0/0/terrains_peering_bit/bottom_right_corner = 0 +1:0/0/terrains_peering_bit/bottom_side = 0 +1:0/0/terrains_peering_bit/bottom_left_corner = 0 +1:0/0/terrains_peering_bit/left_side = 0 +2:0/0 = 0 +2:0/0/terrain_set = 0 +2:0/0/terrain = 0 +2:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16) +2:0/0/terrains_peering_bit/bottom_side = 0 +2:0/0/terrains_peering_bit/bottom_left_corner = 0 +2:0/0/terrains_peering_bit/left_side = 0 +4:0/0 = 0 +4:0/0/terrain_set = 0 +4:0/0/terrain = 0 +4:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16) +4:0/0/terrains_peering_bit/bottom_side = 0 +6:0/0 = 0 +6:0/0/terrain_set = 0 +6:0/0/terrain = 0 +6:0/0/terrains_peering_bit/right_side = 0 +6:0/0/terrains_peering_bit/bottom_side = 0 +6:0/0/terrains_peering_bit/bottom_left_corner = 0 +6:0/0/terrains_peering_bit/left_side = 0 +6:0/0/terrains_peering_bit/top_left_corner = 0 +6:0/0/terrains_peering_bit/top_side = 0 +6:0/0/terrains_peering_bit/top_right_corner = 0 +7:0/0 = 0 +7:0/0/terrain_set = 0 +7:0/0/terrain = 0 +7:0/0/terrains_peering_bit/right_side = 0 +7:0/0/terrains_peering_bit/bottom_right_corner = 0 +7:0/0/terrains_peering_bit/bottom_side = 0 +7:0/0/terrains_peering_bit/left_side = 0 +7:0/0/terrains_peering_bit/top_left_corner = 0 +7:0/0/terrains_peering_bit/top_side = 0 +7:0/0/terrains_peering_bit/top_right_corner = 0 +9:0/0 = 0 +9:0/0/terrain_set = 0 +9:0/0/terrain = 0 +9:0/0/terrains_peering_bit/right_side = 0 +9:0/0/terrains_peering_bit/bottom_right_corner = 0 +9:0/0/terrains_peering_bit/bottom_side = 0 +9:0/0/terrains_peering_bit/bottom_left_corner = 0 +9:0/0/terrains_peering_bit/left_side = 0 +9:0/0/terrains_peering_bit/top_side = 0 +10:0/0 = 0 +10:0/0/terrain_set = 0 +10:0/0/terrain = 0 +10:0/0/terrains_peering_bit/right_side = 0 +10:0/0/terrains_peering_bit/bottom_side = 0 +10:0/0/terrains_peering_bit/bottom_left_corner = 0 +10:0/0/terrains_peering_bit/left_side = 0 +10:0/0/terrains_peering_bit/top_left_corner = 0 +10:0/0/terrains_peering_bit/top_side = 0 +12:0/0 = 0 +12:0/0/terrain_set = 0 +12:0/0/terrain = 0 +12:0/0/terrains_peering_bit/right_side = 0 +12:0/0/terrains_peering_bit/bottom_right_corner = 0 +12:0/0/terrains_peering_bit/bottom_side = 0 +12:0/0/terrains_peering_bit/left_side = 0 +12:0/0/terrains_peering_bit/top_side = 0 +13:0/0 = 0 +13:0/0/terrain_set = 0 +13:0/0/terrain = 0 +13:0/0/terrains_peering_bit/right_side = 0 +13:0/0/terrains_peering_bit/bottom_side = 0 +13:0/0/terrains_peering_bit/bottom_left_corner = 0 +13:0/0/terrains_peering_bit/left_side = 0 +13:0/0/terrains_peering_bit/top_side = 0 +15:0/0 = 0 +15:0/0/terrain_set = 0 +15:0/0/terrain = 0 +15:0/0/terrains_peering_bit/right_side = 0 +15:0/0/terrains_peering_bit/bottom_side = 0 +15:0/0/terrains_peering_bit/left_side = 0 +15:0/0/terrains_peering_bit/top_side = 0 +0:1/0 = 0 +0:1/0/terrain_set = 0 +0:1/0/terrain = 0 +0:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16) +0:1/0/terrains_peering_bit/right_side = 0 +0:1/0/terrains_peering_bit/bottom_right_corner = 0 +0:1/0/terrains_peering_bit/bottom_side = 0 +0:1/0/terrains_peering_bit/top_side = 0 +0:1/0/terrains_peering_bit/top_right_corner = 0 +1:1/0 = 0 +2:1/0 = 0 +2:1/0/terrain_set = 0 +2:1/0/terrain = 0 +2:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16) +2:1/0/terrains_peering_bit/bottom_side = 0 +2:1/0/terrains_peering_bit/bottom_left_corner = 0 +2:1/0/terrains_peering_bit/left_side = 0 +2:1/0/terrains_peering_bit/top_left_corner = 0 +2:1/0/terrains_peering_bit/top_side = 0 +4:1/0 = 0 +4:1/0/terrain_set = 0 +4:1/0/terrain = 0 +4:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16) +4:1/0/terrains_peering_bit/bottom_side = 0 +4:1/0/terrains_peering_bit/top_side = 0 +6:1/0 = 0 +6:1/0/terrain_set = 0 +6:1/0/terrain = 0 +6:1/0/terrains_peering_bit/right_side = 0 +6:1/0/terrains_peering_bit/bottom_right_corner = 0 +6:1/0/terrains_peering_bit/bottom_side = 0 +6:1/0/terrains_peering_bit/bottom_left_corner = 0 +6:1/0/terrains_peering_bit/left_side = 0 +6:1/0/terrains_peering_bit/top_left_corner = 0 +6:1/0/terrains_peering_bit/top_side = 0 +7:1/0 = 0 +7:1/0/terrain_set = 0 +7:1/0/terrain = 0 +7:1/0/terrains_peering_bit/right_side = 0 +7:1/0/terrains_peering_bit/bottom_right_corner = 0 +7:1/0/terrains_peering_bit/bottom_side = 0 +7:1/0/terrains_peering_bit/bottom_left_corner = 0 +7:1/0/terrains_peering_bit/left_side = 0 +7:1/0/terrains_peering_bit/top_side = 0 +7:1/0/terrains_peering_bit/top_right_corner = 0 +9:1/0 = 0 +9:1/0/terrain_set = 0 +9:1/0/terrain = 0 +9:1/0/terrains_peering_bit/right_side = 0 +9:1/0/terrains_peering_bit/bottom_right_corner = 0 +9:1/0/terrains_peering_bit/bottom_side = 0 +9:1/0/terrains_peering_bit/left_side = 0 +9:1/0/terrains_peering_bit/top_side = 0 +9:1/0/terrains_peering_bit/top_right_corner = 0 +10:1/0 = 0 +10:1/0/terrain_set = 0 +10:1/0/terrain = 0 +10:1/0/terrains_peering_bit/right_side = 0 +10:1/0/terrains_peering_bit/bottom_side = 0 +10:1/0/terrains_peering_bit/left_side = 0 +10:1/0/terrains_peering_bit/top_left_corner = 0 +10:1/0/terrains_peering_bit/top_side = 0 +10:1/0/terrains_peering_bit/top_right_corner = 0 +12:1/0 = 0 +12:1/0/terrain_set = 0 +12:1/0/terrain = 0 +12:1/0/terrains_peering_bit/right_side = 0 +12:1/0/terrains_peering_bit/bottom_side = 0 +12:1/0/terrains_peering_bit/left_side = 0 +12:1/0/terrains_peering_bit/top_side = 0 +12:1/0/terrains_peering_bit/top_right_corner = 0 +13:1/0 = 0 +13:1/0/terrain_set = 0 +13:1/0/terrain = 0 +13:1/0/terrains_peering_bit/right_side = 0 +13:1/0/terrains_peering_bit/bottom_side = 0 +13:1/0/terrains_peering_bit/left_side = 0 +13:1/0/terrains_peering_bit/top_left_corner = 0 +13:1/0/terrains_peering_bit/top_side = 0 +15:1/0 = 0 +15:1/0/terrain_set = 0 +15:1/0/terrain = 0 +15:1/0/terrains_peering_bit/right_side = 0 +15:1/0/terrains_peering_bit/bottom_side = 0 +15:1/0/terrains_peering_bit/bottom_left_corner = 0 +15:1/0/terrains_peering_bit/left_side = 0 +15:1/0/terrains_peering_bit/top_side = 0 +15:1/0/terrains_peering_bit/top_right_corner = 0 +16:1/0 = 0 +16:1/0/terrain_set = 0 +16:1/0/terrain = 0 +16:1/0/terrains_peering_bit/right_side = 0 +16:1/0/terrains_peering_bit/bottom_right_corner = 0 +16:1/0/terrains_peering_bit/bottom_side = 0 +16:1/0/terrains_peering_bit/left_side = 0 +16:1/0/terrains_peering_bit/top_left_corner = 0 +16:1/0/terrains_peering_bit/top_side = 0 +0:2/0 = 0 +0:2/0/terrain_set = 0 +0:2/0/terrain = 0 +0:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16) +0:2/0/terrains_peering_bit/right_side = 0 +0:2/0/terrains_peering_bit/top_side = 0 +0:2/0/terrains_peering_bit/top_right_corner = 0 +1:2/0 = 0 +1:2/0/terrain_set = 0 +1:2/0/terrain = 0 +1:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16) +1:2/0/terrains_peering_bit/right_side = 0 +1:2/0/terrains_peering_bit/left_side = 0 +1:2/0/terrains_peering_bit/top_left_corner = 0 +1:2/0/terrains_peering_bit/top_side = 0 +1:2/0/terrains_peering_bit/top_right_corner = 0 +2:2/0 = 0 +2:2/0/terrain_set = 0 +2:2/0/terrain = 0 +2:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16) +2:2/0/terrains_peering_bit/left_side = 0 +2:2/0/terrains_peering_bit/top_left_corner = 0 +2:2/0/terrains_peering_bit/top_side = 0 +4:2/0 = 0 +4:2/0/terrain_set = 0 +4:2/0/terrain = 0 +4:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 6.75, 12.5, 13.5, -13.25, 13, -16, 5) +4:2/0/terrains_peering_bit/top_side = 0 +6:3/0 = 0 +6:3/0/terrain_set = 0 +6:3/0/terrain = 0 +6:3/0/terrains_peering_bit/right_side = 0 +6:3/0/terrains_peering_bit/bottom_side = 0 +6:3/0/terrains_peering_bit/top_side = 0 +6:3/0/terrains_peering_bit/top_right_corner = 0 +7:3/0 = 0 +7:3/0/terrain_set = 0 +7:3/0/terrain = 0 +7:3/0/terrains_peering_bit/bottom_side = 0 +7:3/0/terrains_peering_bit/left_side = 0 +7:3/0/terrains_peering_bit/top_left_corner = 0 +7:3/0/terrains_peering_bit/top_side = 0 +9:3/0 = 0 +9:3/0/terrain_set = 0 +9:3/0/terrain = 0 +9:3/0/terrains_peering_bit/right_side = 0 +9:3/0/terrains_peering_bit/bottom_side = 0 +9:3/0/terrains_peering_bit/bottom_left_corner = 0 +9:3/0/terrains_peering_bit/left_side = 0 +10:3/0 = 0 +10:3/0/terrain_set = 0 +10:3/0/terrain = 0 +10:3/0/terrains_peering_bit/right_side = 0 +10:3/0/terrains_peering_bit/bottom_right_corner = 0 +10:3/0/terrains_peering_bit/bottom_side = 0 +10:3/0/terrains_peering_bit/left_side = 0 +12:3/0 = 0 +12:3/0/terrain_set = 0 +12:3/0/terrain = 0 +12:3/0/terrains_peering_bit/right_side = 0 +12:3/0/terrains_peering_bit/bottom_side = 0 +12:3/0/terrains_peering_bit/top_side = 0 +13:3/0 = 0 +13:3/0/terrain_set = 0 +13:3/0/terrain = 0 +13:3/0/terrains_peering_bit/right_side = 0 +13:3/0/terrains_peering_bit/bottom_side = 0 +13:3/0/terrains_peering_bit/left_side = 0 +15:3/0 = 0 +15:3/0/terrain_set = 0 +15:3/0/terrain = 0 +15:3/0/terrains_peering_bit/right_side = 0 +15:3/0/terrains_peering_bit/bottom_side = 0 +16:3/0 = 0 +16:3/0/terrain_set = 0 +16:3/0/terrain = 0 +16:3/0/terrains_peering_bit/bottom_side = 0 +16:3/0/terrains_peering_bit/left_side = 0 +0:4/0 = 0 +0:4/0/terrain_set = 0 +0:4/0/terrain = 0 +0:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16) +0:4/0/terrains_peering_bit/right_side = 0 +1:4/0 = 0 +1:4/0/terrain_set = 0 +1:4/0/terrain = 0 +1:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16) +1:4/0/terrains_peering_bit/right_side = 0 +1:4/0/terrains_peering_bit/left_side = 0 +2:4/0 = 0 +2:4/0/terrain_set = 0 +2:4/0/terrain = 0 +2:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16) +2:4/0/terrains_peering_bit/left_side = 0 +4:4/0 = 0 +4:4/0/terrain_set = 0 +4:4/0/terrain = 0 +4:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 6.75, 12.5, 13.5, -13.25, 13, -16, 5) +6:4/0 = 0 +6:4/0/terrain_set = 0 +6:4/0/terrain = 0 +6:4/0/terrains_peering_bit/right_side = 0 +6:4/0/terrains_peering_bit/bottom_right_corner = 0 +6:4/0/terrains_peering_bit/bottom_side = 0 +6:4/0/terrains_peering_bit/top_side = 0 +7:4/0 = 0 +7:4/0/terrain_set = 0 +7:4/0/terrain = 0 +7:4/0/terrains_peering_bit/bottom_side = 0 +7:4/0/terrains_peering_bit/bottom_left_corner = 0 +7:4/0/terrains_peering_bit/left_side = 0 +7:4/0/terrains_peering_bit/top_side = 0 +9:4/0 = 0 +9:4/0/terrain_set = 0 +9:4/0/terrain = 0 +9:4/0/terrains_peering_bit/right_side = 0 +9:4/0/terrains_peering_bit/left_side = 0 +9:4/0/terrains_peering_bit/top_left_corner = 0 +9:4/0/terrains_peering_bit/top_side = 0 +10:4/0 = 0 +10:4/0/terrain_set = 0 +10:4/0/terrain = 0 +10:4/0/terrains_peering_bit/right_side = 0 +10:4/0/terrains_peering_bit/left_side = 0 +10:4/0/terrains_peering_bit/top_side = 0 +10:4/0/terrains_peering_bit/top_right_corner = 0 +12:4/0 = 0 +12:4/0/terrain_set = 0 +12:4/0/terrain = 0 +12:4/0/terrains_peering_bit/right_side = 0 +12:4/0/terrains_peering_bit/left_side = 0 +12:4/0/terrains_peering_bit/top_side = 0 +13:4/0 = 0 +13:4/0/terrain_set = 0 +13:4/0/terrain = 0 +13:4/0/terrains_peering_bit/bottom_side = 0 +13:4/0/terrains_peering_bit/left_side = 0 +13:4/0/terrains_peering_bit/top_side = 0 +15:4/0 = 0 +15:4/0/terrain_set = 0 +15:4/0/terrain = 0 +15:4/0/terrains_peering_bit/right_side = 0 +15:4/0/terrains_peering_bit/top_side = 0 +15:4/0/terrains_peering_bit/top_right_corner = 0 +16:4/0 = 0 +16:4/0/terrain_set = 0 +16:4/0/terrain = 0 +16:4/0/terrains_peering_bit/left_side = 0 +16:4/0/terrains_peering_bit/top_side = 0 + +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_7tjg7"] +texture = ExtResource("6_06xm0") +texture_region_size = Vector2i(32, 32) +0:0/0 = 0 +0:0/0/terrain_set = 0 +0:0/0/terrain = 1 + +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_hir5y"] +texture = ExtResource("7_61gcb") +texture_region_size = Vector2i(32, 32) +0:0/0 = 0 +0:0/0/terrain_set = 0 +0:0/0/terrain = 1 +0:0/0/terrains_peering_bit/bottom_side = 1 +0:1/0 = 0 +0:1/0/terrain_set = 0 +0:1/0/terrain = 1 +0:1/0/terrains_peering_bit/top_side = 1 + +[sub_resource type="TileSet" id="TileSet_dj74p"] +tile_size = Vector2i(32, 32) +physics_layer_0/collision_layer = 1 +terrain_set_0/mode = 0 +terrain_set_0/terrain_0/name = "ground" +terrain_set_0/terrain_0/color = Color(0.5, 0.34375, 0.25, 1) +terrain_set_0/terrain_1/name = "vegetation" +terrain_set_0/terrain_1/color = Color(0.5, 0.4375, 0.25, 1) +terrain_set_1/mode = 0 +sources/1 = SubResource("TileSetAtlasSource_ud57a") +sources/2 = SubResource("TileSetAtlasSource_7tjg7") +sources/3 = SubResource("TileSetAtlasSource_hir5y") + +[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_gmy8j"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_ggdp1"] +size = Vector2(72, 20) + +[sub_resource type="CircleShape2D" id="CircleShape2D_opmvx"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_1ymsv"] +size = Vector2(20, 40) + +[node name="Game" type="Node2D"] + +[node name="sky" type="Parallax2D" parent="."] +repeat_size = Vector2(320, 180) +metadata/_edit_group_ = true + +[node name="Sprite2D" type="Sprite2D" parent="sky"] +position = Vector2(160, 90) +texture = ExtResource("1_i0nwn") + +[node name="farbg" type="Parallax2D" parent="."] +scroll_scale = Vector2(0.5, 1) +repeat_size = Vector2(320, 0) +metadata/_edit_group_ = true + +[node name="Sprite2D" type="Sprite2D" parent="farbg"] +position = Vector2(160, 410) +texture = ExtResource("2_6ftlp") + +[node name="midground" type="Parallax2D" parent="."] +repeat_size = Vector2(320, 0) +metadata/_edit_group_ = true + +[node name="Sprite2D" type="Sprite2D" parent="midground"] +position = Vector2(160, 420) +texture = ExtResource("3_34sir") + +[node name="foreground" type="Parallax2D" parent="."] +scroll_scale = Vector2(1.5, 1) +repeat_size = Vector2(320, 0) + +[node name="Sprite2D" type="Sprite2D" parent="foreground"] +position = Vector2(160, 420) +texture = ExtResource("4_o62em") + +[node name="TileMapLayer" type="TileMapLayer" parent="."] +texture_filter = 1 +tile_map_data = PackedByteArray("AAAHAA8AAQAAAAQAAAAIAA8AAQABAAQAAAAJAA8AAQABAAQAAAAKAA8AAQABAAQAAAALAA8AAQABAAQAAAAMAA8AAQABAAQAAAANAA8AAQABAAQAAAAOAA8AAQABAAQAAAAPAA8AAQABAAQAAAAQAA8AAQABAAQAAAARAA8AAQABAAQAAAASAA8AAQABAAQAAAATAA8AAQABAAQAAAAUAA8AAQABAAQAAAAVAA8AAQABAAQAAAAWAA8AAQABAAQAAAAXAA8AAQABAAQAAAAYAA8AAQABAAQAAAAZAA8AAQABAAQAAAAaAA8AAQABAAQAAAAbAA8AAQABAAQAAAAcAA8AAQABAAQAAAAdAA8AAQABAAQAAAAeAA8AAQACAAQAAAASAAwAAQAEAAQAAAAOAA0AAQAAAAQAAAAPAA0AAQABAAQAAAAQAA0AAQACAAQAAAAVAA0AAQAAAAQAAAAWAA0AAQACAAQAAAAYAA0AAQAAAAQAAAAZAA0AAQABAAQAAAAaAA0AAQACAAQAAAAWAAsAAQAAAAQAAAAXAAsAAQAQAAQAAAAXAAoAAQAPAAMAAAAYAAoAAQAQAAQAAAAYAAkAAQAEAAAAAAASAAsAAgAAAAAAAAAYAAwAAgAAAAAAAAAZAAwAAgAAAAAAAAAaAAwAAgAAAAAAAAAOAAwAAwAAAAEAAAAOAAsAAwAAAAAAAAAYAAgAAgAAAAAAAAAcAA4AAwAAAAEAAAAcAA0AAwAAAAAAAAA=") +tile_set = SubResource("TileSet_dj74p") + +[node name="StaticBody2D" type="StaticBody2D" parent="."] +position = Vector2(601, 500) +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"] +shape = SubResource("WorldBoundaryShape2D_gmy8j") + +[node name="level" type="Node2D" parent="."] + +[node name="Brick2" type="StaticBody2D" parent="level"] +position = Vector2(738, 340) +rotation = -0.802851 +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="level/Brick2"] +shape = SubResource("RectangleShape2D_ggdp1") + +[node name="crates" type="Node2D" parent="."] + +[node name="crate1" parent="crates" instance=ExtResource("8_4axuh")] +position = Vector2(481, 369) +script = ExtResource("9_jwr41") + +[node name="crate2" parent="crates" instance=ExtResource("8_4axuh")] +position = Vector2(534, 397) +rotation = 0.380482 +script = ExtResource("9_jwr41") + +[node name="crate4" parent="crates" instance=ExtResource("8_4axuh")] +position = Vector2(628, 345) +rotation = 0.380482 +script = ExtResource("9_jwr41") + +[node name="crate3" parent="crates" instance=ExtResource("8_4axuh")] +position = Vector2(693, 255) +rotation = -0.760964 +script = ExtResource("9_jwr41") + +[node name="CharacterBody2D" parent="." instance=ExtResource("10_poa8t")] +position = Vector2(586, 347) + +[node name="SceneManager" type="Node" parent="."] +unique_name_in_owner = true +script = ExtResource("11_lvxwe") + +[node name="triggers" type="Node2D" parent="."] + +[node name="Trigger" parent="triggers" instance=ExtResource("12_527fi")] +position = Vector2(697, 465) +effect = "destroy" + +[node name="CollisionShape2D" type="CollisionShape2D" parent="triggers/Trigger"] +shape = SubResource("CircleShape2D_opmvx") +debug_color = Color(0.731092, 0.294274, 0.91724, 0.42) + +[node name="powerup" parent="triggers" instance=ExtResource("12_527fi")] +position = Vector2(791, 407) +effect = "powerup" + +[node name="CollisionShape2D" type="CollisionShape2D" parent="triggers/powerup"] +position = Vector2(0, -10) +shape = SubResource("RectangleShape2D_1ymsv") +debug_color = Color(0.156093, 0.622347, 0.484765, 0.42) diff --git a/februarygodotgame/scenes/player.tscn b/februarygodotgame/scenes/player.tscn index e7fe54c..33bc300 100644 --- a/februarygodotgame/scenes/player.tscn +++ b/februarygodotgame/scenes/player.tscn @@ -1,12 +1,29 @@ -[gd_scene load_steps=28 format=3 uid="uid://cjvyslsoa7olc"] +[gd_scene load_steps=33 format=3 uid="uid://cjvyslsoa7olc"] [ext_resource type="Script" path="res://scripts/player.gd" id="1_ffdhb"] +[ext_resource type="Texture2D" uid="uid://c8seclaqrgq6x" path="res://assets/graphics/player/hurt/Player Hurt 48x48.png" id="2_3u4bg"] [ext_resource type="Texture2D" uid="uid://d6cdeej48ryk" path="res://assets/graphics/player/idle/Player Idle 48x48.png" id="2_ekybh"] [ext_resource type="Texture2D" uid="uid://bo4lwotnk3cs" path="res://assets/graphics/player/jump/player jump 48x48.png" id="3_fab18"] [ext_resource type="Texture2D" uid="uid://dny0tvbhrt1jh" path="res://assets/graphics/player/run/player run 48x48.png" id="3_q7el6"] [sub_resource type="CircleShape2D" id="CircleShape2D_q23dn"] +[sub_resource type="AtlasTexture" id="AtlasTexture_40d3p"] +atlas = ExtResource("2_3u4bg") +region = Rect2(0, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_1oa45"] +atlas = ExtResource("2_3u4bg") +region = Rect2(48, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_tcuwl"] +atlas = ExtResource("2_3u4bg") +region = Rect2(96, 0, 48, 48) + +[sub_resource type="AtlasTexture" id="AtlasTexture_26j0m"] +atlas = ExtResource("2_3u4bg") +region = Rect2(144, 0, 48, 48) + [sub_resource type="AtlasTexture" id="AtlasTexture_3ufnv"] atlas = ExtResource("2_ekybh") region = Rect2(0, 0, 48, 48) @@ -95,6 +112,23 @@ region = Rect2(336, 0, 48, 48) animations = [{ "frames": [{ "duration": 1.0, +"texture": SubResource("AtlasTexture_40d3p") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_1oa45") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_tcuwl") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_26j0m") +}], +"loop": false, +"name": &"hurt", +"speed": 12.0 +}, { +"frames": [{ +"duration": 1.0, "texture": SubResource("AtlasTexture_3ufnv") }, { "duration": 1.0, @@ -197,8 +231,10 @@ position = Vector2(-19, -9) texture_filter = 1 position = Vector2(0, -7) sprite_frames = SubResource("SpriteFrames_ok1w6") -animation = &"idle" -autoplay = "jump" +animation = &"run" +autoplay = "hurt" [node name="Camera2D" type="Camera2D" parent="."] offset = Vector2(0, -30) + +[connection signal="animation_finished" from="AnimatedSprite2D" to="." method="_on_animation_finished"] diff --git a/februarygodotgame/scenes/slime.tscn b/februarygodotgame/scenes/slime.tscn new file mode 100644 index 0000000..b027fda --- /dev/null +++ b/februarygodotgame/scenes/slime.tscn @@ -0,0 +1,60 @@ +[gd_scene load_steps=9 format=3 uid="uid://c3blwnpwdol0a"] + +[ext_resource type="Script" path="res://scripts/slime.gd" id="1_idpgq"] +[ext_resource type="Texture2D" uid="uid://gm75hmen7j50" path="res://assets/graphics/enemies/slime_green.png" id="2_834r1"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_v06gt"] +atlas = ExtResource("2_834r1") +region = Rect2(0, 24, 24, 24) + +[sub_resource type="AtlasTexture" id="AtlasTexture_4iai6"] +atlas = ExtResource("2_834r1") +region = Rect2(24, 24, 24, 24) + +[sub_resource type="AtlasTexture" id="AtlasTexture_wyt6l"] +atlas = ExtResource("2_834r1") +region = Rect2(48, 24, 24, 24) + +[sub_resource type="AtlasTexture" id="AtlasTexture_3lt2a"] +atlas = ExtResource("2_834r1") +region = Rect2(72, 24, 24, 24) + +[sub_resource type="SpriteFrames" id="SpriteFrames_bhury"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_v06gt") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_4iai6") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_wyt6l") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_3lt2a") +}], +"loop": true, +"name": &"idle", +"speed": 12.0 +}] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_7ddlr"] +size = Vector2(14, 15) + +[node name="Area2D" type="Area2D"] +script = ExtResource("1_idpgq") + +[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] +texture_filter = 1 +sprite_frames = SubResource("SpriteFrames_bhury") +animation = &"idle" +autoplay = "idle" +frame = 3 +frame_progress = 0.906364 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2(0, 4.5) +shape = SubResource("RectangleShape2D_7ddlr") + +[connection signal="body_entered" from="." to="." method="_on_body_entered"] diff --git a/februarygodotgame/scripts/coin.gd b/februarygodotgame/scripts/coin.gd new file mode 100644 index 0000000..4dcaabe --- /dev/null +++ b/februarygodotgame/scripts/coin.gd @@ -0,0 +1,7 @@ +class_name Coin extends Area2D + +signal coinCollectedSignal(body, coin) + +func _on_body_entered(body: Node2D) -> void: + print("Coin collision") + coinCollectedSignal.emit(body, self) diff --git a/februarygodotgame/scripts/gamecontroller.gd b/februarygodotgame/scripts/gamecontroller.gd index 8719c49..ccd132e 100644 --- a/februarygodotgame/scripts/gamecontroller.gd +++ b/februarygodotgame/scripts/gamecontroller.gd @@ -3,12 +3,43 @@ class_name GameController extends Node2D # Game Data var totalCrates = 4 var cratesDestroyed = 0 +var coinsCollected =0 +var totalCoinsAvailable = 0 + +var enemies = 0 + +signal destroySignal(body) +signal levelCompleteSignal(level) +signal playerHurtSignal(healthRemaining) +#level info +var timer:= Timer.new() +var levels = ["res://scenes/game.tscn","res://scenes/level2.tscn","res://scenes/level3.tscn"] +var timers = [20,15,25] +var currentLevel = 0 +var countdown=0 + +var player:Resource +var slime:Resource # Called when the node enters the scene tree for the first time. func _ready() -> void: - pass # Replace with function body. - - + player = load("res://scripts/res/playerStats.tres") + slime = load("res://scripts/res/slimeStats.tres") + + countdown = timers[currentLevel] + add_child(timer) + timer.wait_time = 1 + timer.one_shot = false + timer.connect("timeout", secondCounter) + timer.start() +func reset(): + countdown = timers[currentLevel] + +func secondCounter(): + countdown -=1 + if countdown <=0: + print("YOU LOSE") + levelCompleteSignal.emit(levels[currentLevel]) # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: pass @@ -20,7 +51,7 @@ func _on_trigger_area_trigger(effect, body) -> void: "destroy": #write code to destroy if body is Crate: - %SceneManager.destroy(body) + destroySignal.emit(body) cratesDestroyed +=1 "powerup": if body is Player: @@ -30,10 +61,38 @@ func bulletHit(body): print("Gamecontroller knows bullet hit") if body is Crate: print("You hit a crate") - cratesDestroyed +=1 - %SceneManager.destroy(body) + totalCrates -=1 + destroySignal.emit(body) print("Crates Remaining :: "+str(totalCrates - cratesDestroyed)) + if totalCrates <=0: + print("You won!!!") + currentLevel +=1 + if currentLevel >= levels.size(): + currentLevel = 0 + levelCompleteSignal.emit(levels[currentLevel]) func numberOfCrates(value): totalCrates = value print("Game Controller knows crates "+str(totalCrates) ) +func numberOfCoins(value): + totalCoinsAvailable = value + +func coinCollected(body, coin): + print("GC knows coin collected") + if body is Player: + #increase coins collected count + coinsCollected +=1 + destroySignal.emit(coin) +func playerDamage(body, badguy): + if body is Player: + print("GC knows player taking damage") + print("Player health "+str(player.health)+" takes damage "+str(slime.meleeDamage)) + player.health -= slime.meleeDamage + if player.health > 0: + playerHurtSignal.emit(player.health) + else: + print("kill em") + + +func numberOfBadguys(value): + enemies = value diff --git a/februarygodotgame/scripts/player.gd b/februarygodotgame/scripts/player.gd index ff5986a..d617d35 100644 --- a/februarygodotgame/scripts/player.gd +++ b/februarygodotgame/scripts/player.gd @@ -17,77 +17,90 @@ var isJumping = false @onready var right_target: Node2D = $rightTarget @onready var left_target: Node2D = $leftTarget +var animPlaying = "idle" +var living = true func _physics_process(delta: float) -> void: - # Add the gravity. - if not is_on_floor(): - velocity += get_gravity() * delta - else: - isJumping = false - + if living and not animPlaying == "hurt": + # 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") + # 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") + if Input.is_action_just_pressed("shove") && pushRightEnabled && faceLeft == false: + pushTarget.apply_central_impulse(Vector2(1,0) * PUSH_FORCE) + pushRightEnabled = false + if Input.is_action_just_pressed("shove") && pushLeftEnabled && faceLeft == true: + pushTarget.apply_central_impulse(Vector2(-1,0) * PUSH_FORCE) + pushLeftEnabled = false + # shoot attack + if Input.is_action_just_pressed("shoot"): + if faceLeft == false: + %SceneManager.makeBullet(right_target.global_transform, 700) + if faceLeft == true: + %SceneManager.makeBullet(left_target.global_transform, -700) - # 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") - if Input.is_action_just_pressed("shove") && pushRightEnabled && faceLeft == false: - pushTarget.apply_central_impulse(Vector2(1,0) * PUSH_FORCE) - pushRightEnabled = false - if Input.is_action_just_pressed("shove") && pushLeftEnabled && faceLeft == true: - pushTarget.apply_central_impulse(Vector2(-1,0) * PUSH_FORCE) - pushLeftEnabled = false - # shoot attack - if Input.is_action_just_pressed("shoot"): - if faceLeft == false: - %SceneManager.makeBullet(right_target.global_transform, 700) - if faceLeft == true: - %SceneManager.makeBullet(left_target.global_transform, -700) - - - if direction: - 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 + if direction: + 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 right_cast.is_colliding(): - print("something on my right") - var collider = right_cast.get_collider() - if collider is Node: - if collider is RigidBody2D: - print("shove this crate") - #record that we can shove right - pushRightEnabled = true - #record what object to shove - pushTarget = collider - if left_cast.is_colliding(): - var collider = left_cast.get_collider() - if collider is Node: - if collider is RigidBody2D: - pushLeftEnabled = true - pushTarget = collider + move_and_slide() + if right_cast.is_colliding(): + print("something on my right") + var collider = right_cast.get_collider() + if collider is Node: + if collider is RigidBody2D: + print("shove this crate") + #record that we can shove right + pushRightEnabled = true + #record what object to shove + pushTarget = collider + if left_cast.is_colliding(): + var collider = left_cast.get_collider() + if collider is Node: + if collider is RigidBody2D: + pushLeftEnabled = true + pushTarget = collider + + for i in get_slide_collision_count(): + var c = get_slide_collision(i) + if c.get_collider() is RigidBody2D: + c.get_collider().apply_central_impulse(-c.get_normal() * 50) - for i in get_slide_collision_count(): - var c = get_slide_collision(i) - if c.get_collider() is RigidBody2D: - c.get_collider().apply_central_impulse(-c.get_normal() * 50) +func hurtPlayer(health): + print("Player takes damage, health remaining:: "+str(health)) + animPlaying = "hurt" + playerGraphic.play(animPlaying) + + +func _on_animation_finished() -> void: + if animPlaying=="hurt": + animPlaying=="idle" diff --git a/februarygodotgame/scripts/res/characterStats.gd b/februarygodotgame/scripts/res/characterStats.gd new file mode 100644 index 0000000..acfaff9 --- /dev/null +++ b/februarygodotgame/scripts/res/characterStats.gd @@ -0,0 +1,8 @@ +class_name CharacterStats extends Resource + +@export var max_health:int = 100 +@export var starting_health:int = 100 +@export var health:int = 100 + +@export var meleeDamage:int = 10 +@export var rangeDamage:int = 8 diff --git a/februarygodotgame/scripts/res/playerStats.tres b/februarygodotgame/scripts/res/playerStats.tres new file mode 100644 index 0000000..ec02cb1 --- /dev/null +++ b/februarygodotgame/scripts/res/playerStats.tres @@ -0,0 +1,11 @@ +[gd_resource type="Resource" script_class="CharacterStats" load_steps=2 format=3 uid="uid://bhxl0nmjr16wm"] + +[ext_resource type="Script" path="res://scripts/res/characterStats.gd" id="1_dc0h5"] + +[resource] +script = ExtResource("1_dc0h5") +max_health = 110 +starting_health = 110 +health = 110 +meleeDamage = 15 +rangeDamage = 6 diff --git a/februarygodotgame/scripts/res/slimeStats.tres b/februarygodotgame/scripts/res/slimeStats.tres new file mode 100644 index 0000000..b5464bf --- /dev/null +++ b/februarygodotgame/scripts/res/slimeStats.tres @@ -0,0 +1,11 @@ +[gd_resource type="Resource" script_class="CharacterStats" load_steps=2 format=3 uid="uid://bmwctbkvbp0en"] + +[ext_resource type="Script" path="res://scripts/res/characterStats.gd" id="1_ev6pb"] + +[resource] +script = ExtResource("1_ev6pb") +max_health = 50 +starting_health = 50 +health = 50 +meleeDamage = 30 +rangeDamage = 0 diff --git a/februarygodotgame/scripts/scene_manager.gd b/februarygodotgame/scripts/scene_manager.gd index 5229bd6..ca8d743 100644 --- a/februarygodotgame/scripts/scene_manager.gd +++ b/februarygodotgame/scripts/scene_manager.gd @@ -1,7 +1,10 @@ extends Node -@onready var gameController: GameController = $".." + @onready var crates: Node2D = $"../crates" @onready var triggers: Node2D = $"../triggers" +@onready var coins: Node2D = $"../coins" +@onready var badguys: Node2D = $"../badguys" +@onready var player: Player = $"../CharacterBody2D" var bulletsFiredTotal = 0 var bulletsMadeTotal = 0 @@ -33,7 +36,7 @@ func makeBullet(position, speed): func bulletHit(bullet, body): print("Tell the game controller a bullet hit something") - gameController.bulletHit(body) + Gamecontroller.bulletHit(body) bullet.setSpeed(0) bullet.position = Vector2(-100,-100) @@ -46,13 +49,40 @@ func buildLevel(): for obj in crates.get_children(): if obj is Crate: totalCrates +=1 - gameController.numberOfCrates(totalCrates) + Gamecontroller.numberOfCrates(totalCrates) + #how many coins? + var totalCoins = 0 + if coins: + for obj in coins.get_children(): + if obj is Coin: + totalCoins +=1 + obj.coinCollectedSignal.connect(Gamecontroller.coinCollected) + Gamecontroller.numberOfCoins(totalCoins) + #how many badguys? + var totalBadguys = 0 + if badguys: + for obj in badguys.get_children(): + if obj is Slime: + totalBadguys +=1 + obj.playerDamageSignal.connect(Gamecontroller.playerDamage) + Gamecontroller.numberOfBadguys(totalBadguys) #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) + obj.areaTrigger.connect(Gamecontroller._on_trigger_area_trigger) + + #listen to gamnecontroller + Gamecontroller.destroySignal.connect(destroy) + Gamecontroller.levelCompleteSignal.connect(loadLevel) + Gamecontroller.playerHurtSignal.connect(playerHurt) + +func loadLevel(level): + get_tree().change_scene_to_file(level) func _ready() -> void: buildLevel() + Gamecontroller.reset() +func playerHurt(health): + player.hurtPlayer(health) diff --git a/februarygodotgame/scripts/slime.gd b/februarygodotgame/scripts/slime.gd new file mode 100644 index 0000000..b9faa9c --- /dev/null +++ b/februarygodotgame/scripts/slime.gd @@ -0,0 +1,7 @@ +class_name Slime extends Area2D + +signal playerDamageSignal + +func _on_body_entered(body: Node2D) -> void: + print("Bad guy contact") + playerDamageSignal.emit(body, self)