From a580dca65b4104c1d287d01bdd52eaf19d96a9e2 Mon Sep 17 00:00:00 2001 From: konzy Date: Mon, 23 Dec 2024 21:28:19 -0500 Subject: [PATCH] multiple level, timer, health, coins --- novembergame/assets/graphics/pickups/gun.png | Bin 0 -> 10603 bytes .../assets/graphics/pickups/gun.png.import | 34 ++ novembergame/scenes/character.tscn | 11 +- novembergame/scenes/game.tscn | 19 +- novembergame/scenes/game_level2.tscn | 486 ++++++++++++++++++ novembergame/scenes/ui.tscn | 45 ++ novembergame/scripts/dudecontroller.gd | 21 +- novembergame/scripts/game_controller.gd | 45 +- novembergame/scripts/scene_manager.gd | 46 +- novembergame/scripts/trigger.gd | 12 +- novembergame/scripts/ui.gd | 23 + 11 files changed, 713 insertions(+), 29 deletions(-) create mode 100644 novembergame/assets/graphics/pickups/gun.png create mode 100644 novembergame/assets/graphics/pickups/gun.png.import create mode 100644 novembergame/scenes/game_level2.tscn create mode 100644 novembergame/scenes/ui.tscn create mode 100644 novembergame/scripts/ui.gd diff --git a/novembergame/assets/graphics/pickups/gun.png b/novembergame/assets/graphics/pickups/gun.png new file mode 100644 index 0000000000000000000000000000000000000000..890a4d04248f2b98851ee0a36ccfeadb9927efc8 GIT binary patch literal 10603 zcmdUVc|27A_y1V3h3xw>M79`XHz>>4*KAo5V`eZ6V;MWyw?ejL3E5>SBq}Oo4cQ_~ zgh~++-V)+>X@7s--}n3T`+WZRKEBMo_jS*l^E~HuUgw;9?!6OdWS~h!!A1cBfvB{# z;KsmF5!fVXh=Kh!uJQ>8L~sJ5re=geB0(U*ex#kW6a7+d}KT17W!IAl1X2Py5@B? z?FD#hbd5!neV}r0nN69{C5~x=EUYZ7!g3|A1&W1<&oW&tnr9O6o9BPa%=ns_KfR~~ zG@|-~m}Ig2I%o~=EhAYcB{?iTBxyRZ+TE+Gf6^GFP0aA76g^+$oWeo~2N_*cw#bWU zM)V2#knp5G3Jq(S6Com6Cyulj!jnWVFH=&|$)W1A)B7L7+uD5D1n50x`Q^yMN}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9n z5LfYGAaY51>7kHrpB-5uyuWWW-$a4g^AAEO(HA*GHWLdnUra8N>TWeGP;!(`rt9-S zrga-jT(-NklJQ9o>U8hJ9Y29?eyVC@cEH;AT#Vcq6pR;|8tH`>NUmboc%rzD%c zAadXOerV_DP`X=k>&;*JjxpboUfF~bhJ1yTa-QV-ZT%hR*w$akn5 zo72^d`u2It&SG%yn!m1$D9}PbMO$b)=<9=ofiW3~lzW^0{8(R(RG5adiVE1pzDO+Yyf`Acb(|lSmHnp2n3l-y?1cbRyTm( IRJ9BLe=DnmfB*mh literal 0 HcmV?d00001 diff --git a/novembergame/assets/graphics/pickups/gun.png.import b/novembergame/assets/graphics/pickups/gun.png.import new file mode 100644 index 0000000..626f00b --- /dev/null +++ b/novembergame/assets/graphics/pickups/gun.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c3xr4fwxpeu23" +path="res://.godot/imported/gun.png-0c592469fac74b3ce84af2d47ecd4d5f.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/pickups/gun.png" +dest_files=["res://.godot/imported/gun.png-0c592469fac74b3ce84af2d47ecd4d5f.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/novembergame/scenes/character.tscn b/novembergame/scenes/character.tscn index c9d6b05..e2b98b0 100644 --- a/novembergame/scenes/character.tscn +++ b/novembergame/scenes/character.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=44 format=3 uid="uid://b6vk2imhuhv0j"] +[gd_scene load_steps=45 format=3 uid="uid://b6vk2imhuhv0j"] [ext_resource type="Script" path="res://scripts/dudecontroller.gd" id="1_esbkk"] [ext_resource type="Texture2D" uid="uid://4hq64jj4kprc" path="res://assets/graphics/player/death/Player Death 64x64.png" id="2_bws84"] @@ -6,6 +6,7 @@ [ext_resource type="Texture2D" uid="uid://da3mdnk0s8bxc" path="res://assets/graphics/player/idle/Player Idle 48x48.png" id="2_jvkyl"] [ext_resource type="Texture2D" uid="uid://cfmrxvwojl071" path="res://assets/graphics/player/jump/player jump 48x48.png" id="3_nnfwu"] [ext_resource type="Texture2D" uid="uid://lk01unajxhx0" path="res://assets/graphics/player/run/player run 48x48.png" id="3_qml56"] +[ext_resource type="Texture2D" uid="uid://c3xr4fwxpeu23" path="res://assets/graphics/pickups/gun.png" id="7_gtasj"] [sub_resource type="CircleShape2D" id="CircleShape2D_drde1"] radius = 15.0 @@ -308,10 +309,16 @@ position = Vector2(-16, -5) texture_filter = 1 position = Vector2(0, -1) sprite_frames = SubResource("SpriteFrames_xt5u3") -animation = &"death" +animation = &"idle" autoplay = "idle" [node name="Camera2D" type="Camera2D" parent="."] offset = Vector2(0, -40) +[node name="Gun" type="Sprite2D" parent="."] +texture_filter = 1 +position = Vector2(11.95, -4.125) +scale = Vector2(0.165, 0.165) +texture = ExtResource("7_gtasj") + [connection signal="animation_finished" from="AnimatedSprite2D" to="." method="_on_animation_finished"] diff --git a/novembergame/scenes/game.tscn b/novembergame/scenes/game.tscn index cac9da3..ffe8126 100644 --- a/novembergame/scenes/game.tscn +++ b/novembergame/scenes/game.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=18 format=4 uid="uid://dmk3hbsrqhgad"] +[gd_scene load_steps=19 format=4 uid="uid://dmk3hbsrqhgad"] [ext_resource type="Texture2D" uid="uid://dv6amvxucgy0g" path="res://assets/graphics/enviroment/terrain/Terrain (32x32).png" id="1_ab3a4"] [ext_resource type="PackedScene" uid="uid://flumvyk8tafw" path="res://scenes/box.tscn" id="1_ixp3c"] @@ -11,6 +11,7 @@ [ext_resource type="PackedScene" uid="uid://e4o5ja1w0gph" path="res://scenes/bullet.tscn" id="4_7436f"] [ext_resource type="PackedScene" uid="uid://bc6587qq8v636" path="res://scenes/coin.tscn" id="10_akvym"] [ext_resource type="PackedScene" uid="uid://bfex451nb78lt" path="res://scenes/badguy.tscn" id="11_387qc"] +[ext_resource type="PackedScene" uid="uid://cvvcvbamynws3" path="res://scenes/ui.tscn" id="12_r6ktn"] [sub_resource type="TileMapPattern" id="TileMapPattern_fkdsw"] tile_data = PackedInt32Array(0, 262144, 0, 65536, 262144, 1, 131072, 262144, 2) @@ -411,7 +412,7 @@ texture = ExtResource("2_w7c1m") [node name="TileMapLayer" type="TileMapLayer" parent="."] position = Vector2(-1, 0) -tile_map_data = PackedByteArray("AAAQAA4AAAAAAAAAAAARAA4AAAABAAAAAAASAA4AAAABAAAAAAATAA4AAAACAAAAAAAXAA4AAAAAAAQAAAAYAA4AAAABAAQAAAAZAA4AAAABAAQAAAAaAA4AAAACAAQAAAAdAAwAAAAAAAAAAAAdAA0AAAAAAAEAAAAdAA4AAAAAAAIAAAAeAAwAAAABAAAAAAAeAA0AAAABAAEAAAAeAA4AAAABAAIAAAAfAAwAAAACAAAAAAAfAA0AAAACAAEAAAAfAA4AAAACAAIAAAAiAA4AAAAAAAQAAAAjAA4AAAABAAQAAAAkAA4AAAABAAQAAAAlAA4AAAACAAQAAAAoAAwAAAAAAAQAAAApAAwAAAABAAQAAAAqAAwAAAABAAQAAAArAAwAAAACAAQAAAAPABQAAAABAAAAAAAQABQAAAABAAAAAAARABQAAAABAAAAAAAOABQAAAABAAAAAAALABQAAAABAAAAAAAMABQAAAABAAAAAAANABQAAAABAAAAAAAIABQAAAABAAAAAAAJABQAAAABAAAAAAAKABQAAAABAAAAAAAFABQAAAABAAAAAAAGABQAAAABAAAAAAAHABQAAAABAAAAAAACABQAAAABAAAAAAADABQAAAABAAAAAAAEABQAAAABAAAAAAASABQAAAABAAAAAAATABQAAAABAAAAAAAUABQAAAABAAAAAAAVABQAAAABAAAAAAAWABQAAAABAAAAAAAXABQAAAABAAAAAAAYABQAAAABAAAAAAAZABQAAAABAAAAAAAaABQAAAABAAAAAAAbABQAAAABAAAAAAAcABQAAAABAAAAAAAdABQAAAABAAAAAAAeABQAAAABAAAAAAAfABQAAAABAAAAAAAgABQAAAABAAAAAAAhABQAAAABAAAAAAAiABQAAAABAAAAAAAjABQAAAABAAAAAAAkABQAAAABAAAAAAABABQAAAABAAAAAAAAABQAAAABAAAAAAAlABQAAAABAAAAAAAmABQAAAABAAAAAAAnABQAAAABAAAAAAAoABQAAAABAAAAAAApABQAAAABAAAAAAAqABQAAAABAAAAAAArABQAAAABAAAAAAAsABQAAAABAAAAAAAtABQAAAABAAAAAAAuABQAAAABAAAAAAAvABQAAAABAAAAAAAwABQAAAABAAAAAAAxABQAAAABAAAAAAAyABQAAAABAAAAAAAzABQAAAABAAAAAAA0ABQAAAABAAAAAAA1ABQAAAABAAAAAAA2ABQAAAABAAAAAAA3ABQAAAABAAAAAAA4ABQAAAABAAAAAAABAA4AAAAAAAQAAAACAA4AAAABAAQAAAADAA4AAAABAAQAAAAEAA4AAAACAAQAAAAIAAwAAAAQAAQAAAAIAAsAAAAEAAAAAAAHAAwAAAAAAAQAAAAEABAAAAAEAAAAAAAEABEAAAAPAAQAAAAFABEAAAABAAQAAAAGABEAAAABAAQAAAAHABEAAAACAAQAAAAIAAUAAAABAAQAAAANAAoAAAAAAAQAAAAPAAoAAAABAAQAAAAOAAoAAAABAAQAAAAQAAoAAAABAAQAAAARAAoAAAABAAQAAAASAAoAAAABAAQAAAATAAoAAAABAAQAAAAUAAoAAAABAAQAAAAVAAoAAAAQAAQAAAAVAAkAAAAEAAEAAAAVAAgAAAAEAAEAAAAVAAcAAAAEAAEAAAAVAAYAAAAEAAEAAAAHAAUAAAABAAQAAAAGAAUAAAABAAQAAAAFAAUAAAABAAQAAAADAAUAAAABAAQAAAAEAAUAAAABAAQAAAACAAUAAAABAAQAAAABAAUAAAABAAQAAAAAAAUAAAAPAAQAA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ACAAQAAAAdAAwAAAAAAAAAAAAdAA0AAAAAAAEAAAAdAA4AAAAAAAIAAAAeAAwAAAABAAAAAAAeAA0AAAABAAEAAAAeAA4AAAABAAIAAAAfAAwAAAACAAAAAAAfAA0AAAACAAEAAAAfAA4AAAACAAIAAAAiAA4AAAAAAAQAAAAjAA4AAAABAAQAAAAkAA4AAAABAAQAAAAlAA4AAAACAAQAAAAoAAwAAAAAAAQAAAApAAwAAAABAAQAAAAqAAwAAAABAAQAAAArAAwAAAACAAQAAAAPABQAAAABAAAAAAAQABQAAAABAAAAAAARABQAAAABAAAAAAAOABQAAAABAAAAAAALABQAAAABAAAAAAAMABQAAAABAAAAAAANABQAAAABAAAAAAAIABQAAAABAAAAAAAJABQAAAABAAAAAAAKABQAAAABAAAAAAAFABQAAAABAAAAAAAGABQAAAABAAAAAAAHABQAAAABAAAAAAACABQAAAABAAAAAAADABQAAAABAAAAAAAEABQAAAABAAAAAAASABQAAAABAAAAAAATABQAAAABAAAAAAAUABQAAAABAAAAAAAVABQAAAABAAAAAAAWABQAAAABAAAAAAAXABQAAAABAAAAAAAYABQAAAABAAAAAAAZABQAAAABAAAAAAAaABQAAAABAAAAAAAbABQAAAABAAAAAAAcABQAAAABAAAAAAAdABQAAAABAAAAAAAeABQAAAABAAAAAAAfABQAAAABAAAAAAAgABQAAAABAAAAAAAhABQAAAABAAAAAAAiABQAAAABAAAAAAAjABQAAAABAAAAAAAkABQAAAABAAAAAAABABQAAAABAAAAAAAAABQAAAABAAAAAAAlABQAAAABAAAAAAAmABQAAAABAAAAAAAnABQAAAABAAAAAAAoABQAAAABAAAAAAApABQAAAABAAAAAAAqABQAAAABAAAAAAArABQAAAABAAAAAAAsABQAAAABAAAAAAAtABQAAAABAAAAAAAuABQAAAABAAAAAAAvABQAAAABAAAAAAAwABQAAAABAAAAAAAxABQAAAABAAAAAAAyABQAAAABAAAAAAAzABQAAAABAAAAAAA0ABQAAAABAAAAAAA1ABQAAAABAAAAAAA2ABQAAAABAA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kAAUAAAABAAQAAAAmAAUAAAABAAQAAAAlAAUAAAABAAQAAAAoAAUAAAABAAQAAAAnAAUAAAABAAQAAAArAAUAAAABAAQAAAAqAAUAAAABAAQAAAApAAUAAAABAAQAAAAvAAUAAAABAAQAAAAuAAUAAAABAAQAAAAtAAUAAAABAAQAAAAsAAUAAAABAAQAAAAxAAUAAAABAAQAAAAwAAUAAAABAAQAAAAyAAUAAAACAAQAAAAAAAQAAAAEAAEAAAAAAAMAAAAEAAEAAAAAAAIAAAAEAAEAAAAAAAEAAAAEAAEAAAAAAAAAAAAEAAEAAAAAAP//AAAPAAAAAAAAAP7/AAAEAAEAAAAAAP3/AAAEAAAAAAACAAMAAAAEAAQAAAAEAAEAAAAEAAQAAAAEAP//AAAEAAQAAAABAP//AAACAAQAAAAHAAIAAAAEAAAAAAAJAAAAAAAEAAAAAAALAAEAAAAEAAAAAAA=") tile_set = SubResource("TileSet_g2n8d") [node name="SceneManager" type="Node" parent="."] @@ -421,13 +422,13 @@ script = ExtResource("1_sylse") [node name="CharacterBody2D" parent="." instance=ExtResource("1_umdfo")] position = Vector2(161, 91) -[node name="Area2D" type="Area2D" parent="."] -position = Vector2(576, 533) -scale = Vector2(18.56, 0.640005) +[node name="GunTrigger" type="Area2D" parent="."] +position = Vector2(367, 26) +scale = Vector2(2.16, 0.640005) script = ExtResource("2_e4xab") metadata/_edit_group_ = true -[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] +[node name="CollisionShape2D" type="CollisionShape2D" parent="GunTrigger"] shape = SubResource("RectangleShape2D_0jo0r") debug_color = Color(0.774214, 0.233911, 0.917118, 0.42) @@ -478,4 +479,8 @@ position = Vector2(47, -50) [node name="Area2D3" parent="enemies" instance=ExtResource("11_387qc")] position = Vector2(391, 122) -[connection signal="body_entered" from="Area2D" to="Area2D" method="_on_body_entered"] +[node name="CanvasLayer" type="CanvasLayer" parent="."] + +[node name="Control" parent="CanvasLayer" instance=ExtResource("12_r6ktn")] + +[connection signal="body_entered" from="GunTrigger" to="GunTrigger" method="_on_body_entered"] diff --git a/novembergame/scenes/game_level2.tscn b/novembergame/scenes/game_level2.tscn new file mode 100644 index 0000000..a321652 --- /dev/null +++ b/novembergame/scenes/game_level2.tscn @@ -0,0 +1,486 @@ +[gd_scene load_steps=19 format=4 uid="uid://cah7v5iqd5ece"] + +[ext_resource type="Texture2D" uid="uid://b46bxahy1a4b1" path="res://assets/graphics/enviroment/background/forestbackground.png" id="1_mkwno"] +[ext_resource type="Texture2D" uid="uid://bihm8chupdlu2" path="res://assets/graphics/enviroment/background/stratosphere.png" id="2_y8f7m"] +[ext_resource type="Texture2D" uid="uid://lj1cipgutadw" path="res://assets/graphics/enviroment/background/midground.png" id="3_n07k2"] +[ext_resource type="Texture2D" uid="uid://dv6amvxucgy0g" path="res://assets/graphics/enviroment/terrain/Terrain (32x32).png" id="4_obncv"] +[ext_resource type="Script" path="res://scripts/scene_manager.gd" id="5_5akcu"] +[ext_resource type="PackedScene" uid="uid://b6vk2imhuhv0j" path="res://scenes/character.tscn" id="6_f6qmn"] +[ext_resource type="Script" path="res://scripts/trigger.gd" id="7_1gm3r"] +[ext_resource type="PackedScene" uid="uid://flumvyk8tafw" path="res://scenes/box.tscn" id="8_bs07h"] +[ext_resource type="PackedScene" uid="uid://e4o5ja1w0gph" path="res://scenes/bullet.tscn" id="9_8a5yu"] +[ext_resource type="PackedScene" uid="uid://bc6587qq8v636" path="res://scenes/coin.tscn" id="10_dxfeb"] +[ext_resource type="PackedScene" uid="uid://bfex451nb78lt" path="res://scenes/badguy.tscn" id="11_cyok7"] +[ext_resource type="PackedScene" uid="uid://cvvcvbamynws3" path="res://scenes/ui.tscn" id="12_wqc7h"] + +[sub_resource type="TileMapPattern" id="TileMapPattern_fkdsw"] +tile_data = PackedInt32Array(0, 262144, 0, 65536, 262144, 1, 131072, 262144, 2) + +[sub_resource type="TileMapPattern" id="TileMapPattern_d80y5"] +tile_data = PackedInt32Array(0, 0, 4, 1, 65536, 4, 2, 65536, 4, 3, 131072, 4) + +[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_xdbrn"] +texture = ExtResource("4_obncv") +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/bottom_right_corner = 0 +12:0/0/terrains_peering_bit/bottom_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/bottom_side = 0 +13:0/0/terrains_peering_bit/bottom_left_corner = 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/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 +1:1/0/terrain_set = 0 +1:1/0/terrains_peering_bit/right_side = 0 +1:1/0/terrains_peering_bit/bottom_right_corner = 0 +1:1/0/terrains_peering_bit/bottom_side = 0 +1:1/0/terrains_peering_bit/bottom_left_corner = 0 +1:1/0/terrains_peering_bit/left_side = 0 +1:1/0/terrains_peering_bit/top_left_corner = 0 +1:1/0/terrains_peering_bit/top_side = 0 +1:1/0/terrains_peering_bit/top_right_corner = 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/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/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/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/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/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/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/bottom_right_corner = 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, 16, -16, 16) +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/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 2.25, -16, 2.5, 16, -16, 16) +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/physics_layer_0/polygon_0/points = PackedVector2Array(-1.25, -16, 16, -16, 16, 16, -1.5, 16) +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/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, -0.75, -16, -1) +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/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, -0.75, -16, -1) +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/physics_layer_0/polygon_0/points = PackedVector2Array(2.5, -16, -16, -16, -16, 16, 2.25, 16) +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/physics_layer_0/polygon_0/points = PackedVector2Array(16, -16, -16, -16, -16, -1.5, 16, -1.25) +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/physics_layer_0/polygon_0/points = PackedVector2Array(16, -16, 16, 16, -16, 16, -16, -16) +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/physics_layer_0/polygon_0/points = PackedVector2Array(16, -16, 16, 16, -16, 16, -16, -16) +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, 16, -16, 16) +6:4/0 = 0 +6:4/0/terrain_set = 0 +6:4/0/terrain = 0 +6:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 2.25, -16, 2.5, 16, -16, 16) +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/physics_layer_0/polygon_0/points = PackedVector2Array(-1.25, -16, 16, -16, 16, 16, -1.5, 16) +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/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -0.75, 16, -0.75, 16, 16, -16, 16) +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/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -0.75, 16, -0.75, 16, 16, -16, 16) +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/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -0.75, 16, -0.75, 16, 16, -16, 16) +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/physics_layer_0/polygon_0/points = PackedVector2Array(0.75, 1.75, 1.5, -16, 16, -16, 16, 16, -16, 16, -16, 2) +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/physics_layer_0/polygon_0/points = PackedVector2Array(16, -16, 16, 16, -16, 16, -16, -16) +15:4/0/terrains_peering_bit/right_side = 0 +15:4/0/terrains_peering_bit/top_side = 0 +16:4/0 = 0 +16:4/0/terrain_set = 0 +16:4/0/terrain = 0 +16:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(16, -16, 16, 16, -16, 16, -16, -16) +16:4/0/terrains_peering_bit/left_side = 0 +16:4/0/terrains_peering_bit/top_side = 0 + +[sub_resource type="TileSet" id="TileSet_g2n8d"] +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_1/mode = 0 +terrain_set_1/terrain_0/name = "Sky" +terrain_set_1/terrain_0/color = Color(0.221849, 0.355777, 0.718167, 1) +sources/0 = SubResource("TileSetAtlasSource_xdbrn") +pattern_0 = SubResource("TileMapPattern_fkdsw") +pattern_1 = SubResource("TileMapPattern_d80y5") + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_0jo0r"] + +[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_jsnkw"] + +[node name="Game" type="Node2D"] + +[node name="Background" type="Parallax2D" parent="."] +scroll_scale = Vector2(0.5, 1) +repeat_size = Vector2(320, 0) + +[node name="Forest" type="Sprite2D" parent="Background"] +texture_filter = 1 +position = Vector2(160, 90) +texture = ExtResource("1_mkwno") + +[node name="Sprite2D" type="Sprite2D" parent="Background"] +position = Vector2(160, -58) +scale = Vector2(1, 3.86667) +texture = ExtResource("2_y8f7m") + +[node name="Midground" type="Parallax2D" parent="."] +repeat_size = Vector2(320, 0) + +[node name="Sprite2D" type="Sprite2D" parent="Midground"] +texture_filter = 1 +position = Vector2(160, 90) +texture = ExtResource("3_n07k2") + +[node name="TileMapLayer" type="TileMapLayer" parent="."] +position = Vector2(-1, 0) +tile_map_data = PackedByteArray("AAAQAA4AAAAAAAAAAAARAA4AAAABAAAAAAASAA4AAAABAAAAAAATAA4AAAACAAAAAAAXAA4AAAAAAAQAAAAYAA4AAAABAAQAAAAZAA4AAAABAAQAAAAaAA4AAAACAAQAAAAdAAwAAAAAAAAAAAAdAA0AAAAAAAEAAAAdAA4AAAAAAAIAAAAeAAwAAAABAAAAAAAeAA0AAAABAAEAAAAeAA4AAAABAAIAAAAfAAwAAAACAAAAAAAfAA0AAAACAAEAAAAfAA4AAAACAAIAAAAiAA4AAAAAAAQAAAAjAA4AAAABAAQAAAAkAA4AAAABAAQAAAAlAA4AAAACAAQAAAAoAAwAAAAAAAQAAAApAAwAAAABAAQAAAAqAAwAAAABAAQAAAArAAwAAAACAAQAAAAPABQAAAABAAAAAAAQABQAAAABAAAAAAARABQAAAABAAAAAAAOABQAAAABAAAAAAALABQAAAABAAAAAAAMABQAAAABAAAAAAANABQAAAABAAAAAAAIABQAAAABAAAAAAAJABQAAAABAAAAAAAKABQAAAABAAAAAAAFABQAAAABAAAAAAAGABQAAAABAAAAAAAHABQAAAABAAAAAAACABQAAAABAAAAAAADABQAAAABAAAAAAAEABQAAAABAAAAAAASABQAAAABAAAAAAATABQAAAABAAAAAAAUABQAAAABAAAAAAAVABQAAAABAAAAAAAWABQAAAABAAAAAAAXABQAAAABAAAAAAAYABQAAAABAAAAAAAZABQAAAABAAAAAAAaABQAAAABAAAAAAAbABQAAAABAAAAAAAcABQAAAABAAAAAAAdABQAAAABAAAAAAAeABQAAAABAAAAAAAfABQAAAABAAAAAAAgABQAAAABAAAAAAAhABQAAAABAAAAAAAiABQAAAABAAAAAAAjABQAAAABAAAAAAAkABQAAAABAAAAAAABABQAAAABAAAAAAAAABQAAAABAAAAAAAlABQAAAABAAAAAAAmABQAAAABAAAAAAAnABQAAAABAAAAAAAoABQAAAABAAAAAAApABQAAAABAAAAAAAqABQAAAABAAAAAAArABQAAAABAAAAAAAsABQAAAABAAAAAAAtABQAAAABAAAAAAAuABQAAAABAAAAAAAvABQAAAABAAAAAAAwABQAAAABAAAAAAAxABQAAAABAAAAAAAyABQAAAABAAAAAAAzABQAAAABAAAAAAA0ABQAAAABAAAAAAA1ABQAAAABAAAAAAA2ABQAAAABAAAAAAA3ABQAAAABAAAAAAA4ABQAAAABAAAAAAABAA4AAAAAAAQAAAACAA4AAAABAAQAAAADAA4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ABAAQAAAArAAUAAAABAAQAAAAqAAUAAAABAAQAAAApAAUAAAABAAQAAAAvAAUAAAABAAQAAAAuAAUAAAABAAQAAAAtAAUAAAABAAQAAAAsAAUAAAABAAQAAAAxAAUAAAABAAQAAAAwAAUAAAABAAQAAAAyAAUAAAACAAQAAAAAAAQAAAAEAAEAAAAAAAMAAAAEAAEAAAAAAAIAAAAEAAEAAAAAAAEAAAAEAAEAAAAAAAAAAAAEAAEAAAAAAP//AAAPAAAAAAAAAP7/AAAEAAEAAAAAAP3/AAAEAAAAAAAHAAMAAAAEAAQAAAAJAAEAAAAEAAQAAAAMAP//AAAEAAQAAAAPAP7/AAAEAAQAAAASAP3/AAAEAAQAAAAVAP//AAAEAAQAAAA=") +tile_set = SubResource("TileSet_g2n8d") + +[node name="SceneManager" type="Node" parent="."] +unique_name_in_owner = true +script = ExtResource("5_5akcu") + +[node name="CharacterBody2D" parent="." instance=ExtResource("6_f6qmn")] +position = Vector2(161, 91) + +[node name="Area2D" type="Area2D" parent="."] +position = Vector2(576, 533) +scale = Vector2(18.56, 0.640005) +script = ExtResource("7_1gm3r") +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] +shape = SubResource("RectangleShape2D_0jo0r") +debug_color = Color(0.774214, 0.233911, 0.917118, 0.42) + +[node name="RigidBody2D" parent="." instance=ExtResource("8_bs07h")] +position = Vector2(466, 45) + +[node name="RigidBody2D2" parent="." instance=ExtResource("8_bs07h")] +position = Vector2(546, 45) + +[node name="RigidBody2D3" parent="." instance=ExtResource("8_bs07h")] +position = Vector2(634, 44) + +[node name="StaticBody2D" type="StaticBody2D" parent="."] +position = Vector2(592, 169) +metadata/_edit_group_ = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"] +shape = SubResource("WorldBoundaryShape2D_jsnkw") + +[node name="Area2D2" parent="." instance=ExtResource("9_8a5yu")] +position = Vector2(207, 491) + +[node name="Parallax2D" type="Parallax2D" parent="."] +visible = false +scroll_scale = Vector2(2, 1) +repeat_size = Vector2(320, 0) + +[node name="Sprite2D" type="Sprite2D" parent="Parallax2D"] +position = Vector2(180, 120) +texture = ExtResource("3_n07k2") + +[node name="Coins" type="Node" parent="."] + +[node name="Coin" parent="Coins" instance=ExtResource("10_dxfeb")] +position = Vector2(686, -47) + +[node name="Coin2" parent="Coins" instance=ExtResource("10_dxfeb")] +position = Vector2(494, -79) + +[node name="Coin3" parent="Coins" instance=ExtResource("10_dxfeb")] +position = Vector2(395, -45) + +[node name="Coin4" parent="Coins" instance=ExtResource("10_dxfeb")] +position = Vector2(299, 17) + +[node name="enemies" type="Node" parent="."] + +[node name="Area2D3" parent="enemies" instance=ExtResource("11_cyok7")] +position = Vector2(583, -103) + +[node name="CanvasLayer" type="CanvasLayer" parent="."] + +[node name="Control" parent="CanvasLayer" instance=ExtResource("12_wqc7h")] + +[connection signal="body_entered" from="Area2D" to="Area2D" method="_on_body_entered"] diff --git a/novembergame/scenes/ui.tscn b/novembergame/scenes/ui.tscn new file mode 100644 index 0000000..09fab70 --- /dev/null +++ b/novembergame/scenes/ui.tscn @@ -0,0 +1,45 @@ +[gd_scene load_steps=2 format=3 uid="uid://cvvcvbamynws3"] + +[ext_resource type="Script" path="res://scripts/ui.gd" id="1_m10rs"] + +[node name="Control" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_m10rs") + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +layout_mode = 1 +anchors_preset = 10 +anchor_right = 1.0 +grow_horizontal = 2 + +[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"] +layout_mode = 2 + +[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="health" type="Label" parent="VBoxContainer/HBoxContainer/MarginContainer"] +layout_mode = 2 +text = "Health: 100" + +[node name="MarginContainer3" type="MarginContainer" parent="VBoxContainer/HBoxContainer"] +layout_mode = 2 + +[node name="timer" type="Label" parent="VBoxContainer/HBoxContainer/MarginContainer3"] +layout_mode = 2 +text = "Timer: 10" + +[node name="MarginContainer2" type="MarginContainer" parent="VBoxContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="coins" type="Label" parent="VBoxContainer/HBoxContainer/MarginContainer2"] +layout_mode = 2 +text = "Coins: 0" +horizontal_alignment = 2 diff --git a/novembergame/scripts/dudecontroller.gd b/novembergame/scripts/dudecontroller.gd index 12e4b56..366a485 100644 --- a/novembergame/scripts/dudecontroller.gd +++ b/novembergame/scripts/dudecontroller.gd @@ -9,6 +9,7 @@ const PUSH_FORCE = 750 @onready var right_ray: RayCast2D = $RightRay @onready var left_ray: RayCast2D = $LeftRay @onready var playerSprite: AnimatedSprite2D = $AnimatedSprite2D +@onready var gun: Sprite2D = $Gun var faceLeft = false @@ -26,18 +27,27 @@ signal playerDead @onready var right_target: Node2D = $RightTarget @onready var left_target: Node2D = $LeftTarget +func _ready() -> void: + gunDrop() + func hurtPlayer(amt): - print("Character knows it should hurt") + animPlaying = "hurt" playerSprite.play("hurt") func killPlayer(): - print("Characters know it is the end") if living: living = false animPlaying = "death" playerSprite.play(animPlaying) +func gunCollected(): + print("player knows to show gun") + gun.visible = true + +func gunDrop(): + gun.visible = false + func _physics_process(delta: float) -> void: if living and not animPlaying == "hurt": # Add the gravity. @@ -52,7 +62,7 @@ func _physics_process(delta: float) -> void: # As good practice, you should replace UI actions with custom gameplay actions. var direction := Input.get_axis("ui_left", "ui_right") if Input.is_action_just_pressed("shove") && pushRightEnabled && faceLeft == false: - print("shove a box") + pushTarget.apply_central_impulse(Vector2(1,0) * PUSH_FORCE * 2) pushRightEnabled = false @@ -61,7 +71,6 @@ func _physics_process(delta: float) -> void: pushLeftEnabled = false if Input.is_action_just_pressed("shoot"): - print("shoot a bullet") var mybullet = %SceneManager.bulletFactory() if not faceLeft: mybullet.transform = right_target.global_transform @@ -99,24 +108,20 @@ func _physics_process(delta: float) -> void: move_and_slide() if right_ray.is_colliding(): - print("Something is on my right") if not faceLeft: var collider = right_ray.get_collider() if collider is Node: if collider.is_in_group("box"): - print("This is a pushable box") pushTarget = collider pushRightEnabled = true else: pushRightEnabled = false if left_ray.is_colliding(): - print("Something is on my left") if faceLeft: var collider = left_ray.get_collider() if collider is Node: if collider.is_in_group("box"): - print("This is a pushable box") pushTarget = collider pushLeftEnabled = true else: diff --git a/novembergame/scripts/game_controller.gd b/novembergame/scripts/game_controller.gd index a5346f1..f577258 100644 --- a/novembergame/scripts/game_controller.gd +++ b/novembergame/scripts/game_controller.gd @@ -2,22 +2,52 @@ extends Node var coinsCollected:int = 0 var player:Resource +var totalCoinsLevel = 0 +var levels = ["res://scenes/game.tscn", "res://scenes/game_level2.tscn"] +var timers = [25, 19] +var currentLevel = 0 + +var gameSeconds = 0 + +var gotGun = false signal playerHurt(amt) signal playerDeath() +signal coinsUpdate(amt, total) +signal levelComplete(level) +signal tick(seconds) +signal playerOptions(gun) # Called when the node enters the scene tree for the first time. func _ready() -> void: player = load("res://scripts/res/playerstats.tres") - +func setTotalCoins(amt): + totalCoinsLevel = amt + print(str(coinsCollected)+ " "+str(totalCoinsLevel)) + coinsUpdate.emit(coinsCollected, totalCoinsLevel) + # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: pass +func gunCollected(): + print("GameController knows player has gun") + gotGun = true + func coinCollected(): coinsCollected += 1 print("Total coins collecte " + str(coinsCollected)) + coinsUpdate.emit(coinsCollected, totalCoinsLevel) + # did you complete the level + if coinsCollected >= totalCoinsLevel: + # level complete + currentLevel +=1 + if currentLevel < levels.size(): + levelComplete.emit(levels[currentLevel]) + else: + currentLevel = 0 + levelComplete.emit(levels[currentLevel]) func playerDamage(): if player.health > 0: @@ -27,8 +57,19 @@ func playerDamage(): playerDeath.emit() else: ## damage him - playerHurt.emit(20) + playerHurt.emit(player.health) func reset(): + gameSeconds = 0 player.health = player.max_health coinsCollected = 0 + + +func timeOut(): + gameSeconds += 1 + if gameSeconds >= timers[currentLevel]: + playerDeath.emit() + tick.emit(timers[currentLevel] - gameSeconds) + +func sendOptions(): + playerOptions.emit(gotGun) diff --git a/novembergame/scripts/scene_manager.gd b/novembergame/scripts/scene_manager.gd index f2b0e90..1c5abc5 100644 --- a/novembergame/scripts/scene_manager.gd +++ b/novembergame/scripts/scene_manager.gd @@ -3,30 +3,59 @@ extends Node var bulletsFiredTotal := 0 var bulletsMadeTotal := 0 var bulletArray:Array = [] +var timer:= Timer.new() + @onready var coins: Node = $"../Coins" @onready var enemies: Node = $"../enemies" +@onready var gun_trigger: Area2D = $"../GunTrigger" @onready var player: CharacterBody2D = $"../CharacterBody2D" +@onready var ui: Control = $"../CanvasLayer/Control" var bullet = preload("res://scenes/bullet.tscn") func _ready() -> void: + add_child(timer) + timer.wait_time = 1 + timer.one_shot = false + timer.connect("timeout", GameController.timeOut) + timer.start() + + var totalCoins = 0 + var totalEnemies = 0 ## Coins loop for n in coins.get_children(): - print("coin found") + totalCoins += 1 n.coinCollected.connect(GameController.coinCollected) ## enemy loop for n in enemies.get_children(): - print("enemy found") + totalEnemies += 1 n.playerDamage.connect(GameController.playerDamage) - ## wire up game controller signals to Player + + + ## wire up GameController signals to Player GameController.playerHurt.connect(hurtPlayer) + GameController.playerHurt.connect(ui.healthUpdate) GameController.playerDeath.connect(killPlayer) + GameController.levelComplete.connect(changeLevel) + GameController.tick.connect(ui.timerUpdate) + GameController.playerOptions.connect(showGun) + + gun_trigger.gunCollect.connect(GameController.gunCollected) + gun_trigger.gunCollect.connect(player.gunCollected) player.playerDead.connect(deadPlayer) + + + GameController.coinsUpdate.connect(ui.coinsUpdate) + + GameController.setTotalCoins(totalCoins) + + GameController.sendOptions() + func bulletFactory(): print("Make a bullet at the factory") var mybullet @@ -60,3 +89,14 @@ func killPlayer(): func deadPlayer(): GameController.reset() get_tree().reload_current_scene() + +func showGun(gun): + if gun == true: + player.gunCollected() + else: + player.gunDrop() + +func changeLevel(level): + print("Scene Manager should change level") + GameController.reset() + get_tree().change_scene_to_file(level) diff --git a/novembergame/scripts/trigger.gd b/novembergame/scripts/trigger.gd index e27a287..4ee7c82 100644 --- a/novembergame/scripts/trigger.gd +++ b/novembergame/scripts/trigger.gd @@ -1,6 +1,6 @@ extends Area2D -var BoxCount = 0 -var MaxBoxes = 3 + +signal gunCollect # Called when the node enters the scene tree for the first time. func _ready() -> void: @@ -14,8 +14,6 @@ func _process(delta: float) -> void: func _on_body_entered(body: Node2D) -> void: print("Trigger saw a thing") - if body.is_in_group("box"): - print("box hit the trigger") - BoxCount +=1 - if BoxCount >= MaxBoxes: - print("YU WUN") + if body.is_in_group("player"): + print("player entered area") + gunCollect.emit() diff --git a/novembergame/scripts/ui.gd b/novembergame/scripts/ui.gd new file mode 100644 index 0000000..cb17d83 --- /dev/null +++ b/novembergame/scripts/ui.gd @@ -0,0 +1,23 @@ +extends Control +@onready var health: Label = $VBoxContainer/HBoxContainer/MarginContainer/health +@onready var coins: Label = $VBoxContainer/HBoxContainer/MarginContainer2/coins +@onready var timer: Label = $VBoxContainer/HBoxContainer/MarginContainer3/timer + +var tempCoinCount = 0 +var tempCoinTotal = 0 + +func timerUpdate(amt): + timer.text = "Seconds : " + str(amt) + +func healthUpdate(amt): + health.text = ("Heath : " + str(amt)) + +func coinsUpdate(amt, total): + print("Update the UI " +str(amt)) + tempCoinCount = amt + tempCoinTotal = total + if coins: + coins.text = ("Coins: " + str(amt) + " of " + str(total)) + +func _ready() -> void: + coins.text = "Coins: " + str(tempCoinCount) + " of " + str(tempCoinTotal)