diff --git a/assets/Images/drink-tea-svgrepo-com.svg b/assets/Images/drink-tea-svgrepo-com.svg new file mode 100644 index 0000000..6106179 --- /dev/null +++ b/assets/Images/drink-tea-svgrepo-com.svg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8fa1a8848cecf49af82749193cd4a4db48016c4a05799abd6315413b15062ef4 +size 694 diff --git a/assets/Images/drink-tea-svgrepo-com.svg.import b/assets/Images/drink-tea-svgrepo-com.svg.import new file mode 100644 index 0000000..39ce3b2 --- /dev/null +++ b/assets/Images/drink-tea-svgrepo-com.svg.import @@ -0,0 +1,44 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cq5agx2karf0a" +path.s3tc="res://.godot/imported/drink-tea-svgrepo-com.svg-675a19c3e990ab00b5a0cb1303128a33.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://assets/Images/drink-tea-svgrepo-com.svg" +dest_files=["res://.godot/imported/drink-tea-svgrepo-com.svg-675a19c3e990ab00b5a0cb1303128a33.s3tc.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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=0 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/assets/Images/time-add-svgrepo-com.svg b/assets/Images/time-add-svgrepo-com.svg new file mode 100644 index 0000000..45a3709 --- /dev/null +++ b/assets/Images/time-add-svgrepo-com.svg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:62f0af01fecc91c2e28f5490499243add7532fd6a6ff9f29643ea54da6b5bd28 +size 563 diff --git a/assets/Images/time-add-svgrepo-com.svg.import b/assets/Images/time-add-svgrepo-com.svg.import new file mode 100644 index 0000000..42ed14e --- /dev/null +++ b/assets/Images/time-add-svgrepo-com.svg.import @@ -0,0 +1,44 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://jc723dycmkud" +path.s3tc="res://.godot/imported/time-add-svgrepo-com.svg-74e89ddd2f8c60e8e7715f5bb5a2c57b.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://assets/Images/time-add-svgrepo-com.svg" +dest_files=["res://.godot/imported/time-add-svgrepo-com.svg-74e89ddd2f8c60e8e7715f5bb5a2c57b.s3tc.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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=0 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/cc.txt b/cc.txt index 75df320..97e4613 100644 --- a/cc.txt +++ b/cc.txt @@ -1,2 +1,3 @@ Rails by dook [CC-BY] (https://creativecommons.org/licenses/by/3.0/) via Poly Pizza (https://poly.pizza/m/5JTOJuMHJw) Jim the Linux Penguin by Rebekah Yoder is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. +Drink Tea SVG Vector by Zlatko Najdenovski is licensed under a Creative COmmons Attribution International License. diff --git a/level.gd b/level.gd index 74bfe41..969168a 100644 --- a/level.gd +++ b/level.gd @@ -9,10 +9,12 @@ var dimension: int = BASE_DIMENSION # Spawn Rate = rate - floor(stage_count * stage_mod) @export var ped_spawn_rate_stage_modifier: float = 0.5 -var pedestrian_scn = preload("res://pedestrian.tscn") -var chunk_scn = preload("res://chunk.tscn") -var station_scn = preload("res://station.tscn") -var spawn_scn = preload("res://spawn.tscn") +var pedestrian_scn = preload("res://pedestrian.tscn") +var chunk_scn = preload("res://chunk.tscn") +var station_scn = preload("res://station.tscn") +var spawn_scn = preload("res://spawn.tscn") +var bonus_time_scn = preload("res://pickup/bonus_time.tscn") +var speed_boost_scn = preload("res://pickup/speed_boost.tscn") func dir_to_vector(dir: int) -> Vector2i: assert(dir >= 0 and dir <= 3) @@ -49,6 +51,16 @@ func initialize_world() -> void: $Player.position.x = spawn.x * Global.chunk_size $Player.position.z = spawn.y * Global.chunk_size + var bt = bonus_time_scn.instantiate() + bt.position.x = spawn.x * Global.chunk_size - 10 + bt.position.z = spawn.y * Global.chunk_size + 20 + add_child(bt) + + var sb = speed_boost_scn.instantiate() + sb.position.x = spawn.x * Global.chunk_size + 10 + sb.position.z = spawn.y * Global.chunk_size + 20 + add_child(sb) + # ---- Generate the paths ---- var paths: Array = [] for path_idx in range(path_count): diff --git a/pickup/bonus_time.tscn b/pickup/bonus_time.tscn new file mode 100644 index 0000000..bcbfd10 --- /dev/null +++ b/pickup/bonus_time.tscn @@ -0,0 +1,45 @@ +[gd_scene format=3 uid="uid://dhlgypwxsdvi1"] + +[ext_resource type="Texture2D" uid="uid://jc723dycmkud" path="res://assets/Images/time-add-svgrepo-com.svg" id="1_rqnpm"] + +[sub_resource type="GDScript" id="GDScript_rqnpm"] +script/source = "extends Node3D + +func _on_area_entered(area: Area3D) -> void: + if area.name != \"Hurtbox\": + return + + var parent = area.get_parent() + + if parent.name == \"Player\": + var timer: Timer = parent.get_node(\"TimeLimit\") + timer.start(timer.time_left + parent.bonus_time_amount) + queue_free() +" + +[sub_resource type="PlaneMesh" id="PlaneMesh_b5fwd"] + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_cumbd"] +transparency = 1 +albedo_texture = ExtResource("1_rqnpm") + +[sub_resource type="CylinderShape3D" id="CylinderShape3D_rqnpm"] +height = 2.5239258 +radius = 2.3896484 + +[node name="BonusTime" type="Node3D" unique_id=2030295907] +script = SubResource("GDScript_rqnpm") + +[node name="Cartell" type="MeshInstance3D" parent="." unique_id=1340947697] +transform = Transform3D(2.0101042, 0, 0, 0, 2.0101042, 0, 0, 0, 2.0101042, 0, 0.28158534, 0) +mesh = SubResource("PlaneMesh_b5fwd") +surface_material_override/0 = SubResource("StandardMaterial3D_cumbd") + +[node name="BonusTimeArea" type="Area3D" parent="." unique_id=2068048094] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.28158534, 0) + +[node name="CollisionShape3D" type="CollisionShape3D" parent="BonusTimeArea" unique_id=62431841] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.2619629, 0) +shape = SubResource("CylinderShape3D_rqnpm") + +[connection signal="area_entered" from="BonusTimeArea" to="." method="_on_area_entered"] diff --git a/pickup/speed_boost.tscn b/pickup/speed_boost.tscn new file mode 100644 index 0000000..5417ce3 --- /dev/null +++ b/pickup/speed_boost.tscn @@ -0,0 +1,44 @@ +[gd_scene format=3 uid="uid://ckx20kekib0od"] + +[ext_resource type="Texture2D" uid="uid://cq5agx2karf0a" path="res://assets/Images/drink-tea-svgrepo-com.svg" id="1_y24h4"] + +[sub_resource type="GDScript" id="GDScript_rqnpm"] +script/source = "extends Node3D + +func _on_area_entered(area: Area3D) -> void: + if area.name != \"Hurtbox\": + return + + var player = area.get_parent() + if player.name == \"Player\": + var timer: Timer = player.get_node(\"SpeedBoostTimer\") + timer.start() + queue_free() +" + +[sub_resource type="PlaneMesh" id="PlaneMesh_b5fwd"] + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_cumbd"] +transparency = 1 +albedo_texture = ExtResource("1_y24h4") + +[sub_resource type="CylinderShape3D" id="CylinderShape3D_rqnpm"] +height = 2.5239258 +radius = 2.3896484 + +[node name="SpeedBoost" type="Node3D" unique_id=2030295907] +script = SubResource("GDScript_rqnpm") + +[node name="Cartell" type="MeshInstance3D" parent="." unique_id=1340947697] +transform = Transform3D(2.0101042, 0, 0, 0, 2.0101042, 0, 0, 0, 2.0101042, 0, 0.28158534, 0) +mesh = SubResource("PlaneMesh_b5fwd") +surface_material_override/0 = SubResource("StandardMaterial3D_cumbd") + +[node name="SpeedBoostArea" type="Area3D" parent="." unique_id=2068048094] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.28158534, 0) + +[node name="CollisionShape3D" type="CollisionShape3D" parent="SpeedBoostArea" unique_id=62431841] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.2619629, 0) +shape = SubResource("CylinderShape3D_rqnpm") + +[connection signal="area_entered" from="SpeedBoostArea" to="." method="_on_area_entered"] diff --git a/player.gd b/player.gd index 240e698..7b627db 100644 --- a/player.gd +++ b/player.gd @@ -9,11 +9,24 @@ const SLOW_MULT = 0.5 const STAMINA_COST = 15 const STAMINA_RECOVER = 10 +const SCORE_RANK = { + "C": { "time": 10, "money": 500, "color": Color.BROWN }, + "B": { "time": 20, "money": 1000, "color": Color.PURPLE }, + "A": { "time": 30, "money": 1500, "color": Color.GREEN }, + "S": { "time": 999, "money": 2000, "color": Color.YELLOW }, +} + var pedestrian_area_count = 0 var max_stamina: float = BASE_STAMINA var stamina: float = max_stamina +# ---- Pickups ---- +const BASE_BONUS_TIME_AMOUNT = 30 # seconds +const BASE_SPEED_BOOST_FACTOR = 2 +var bonus_time_amount: float = BASE_BONUS_TIME_AMOUNT # seconds +var speed_boost_factor: float = BASE_SPEED_BOOST_FACTOR + var stage_counter: int = 0 var is_active: bool = true @@ -40,10 +53,12 @@ func _process(delta: float) -> void: var time_left = int($TimeLimit.time_left) @warning_ignore("integer_division") - $HUD/TimeLimitLabel.text = "%02d:%02d" % [time_left/60, time_left] + $HUD/TimeLimitLabel.text = "%02d:%02d" % [time_left/60, time_left - (time_left/60) * 60] var dir = Input.get_vector("player_move_left", "player_move_right", "player_move_up", "player_move_down") var speed: float = BASE_SPEED + if $SpeedBoostTimer.time_left > 0: + speed *= speed_boost_factor if (pedestrian_area_count > 0): speed *= SLOW_MULT @@ -67,10 +82,19 @@ func _on_area_area_entered(area: Area3D) -> void: if area.name == "StationArea": $FinishControl.visible = true $HUD.visible = false + var scoreLbl = $FinishControl/ScoreLabel + for letter in SCORE_RANK: + var rank = SCORE_RANK[letter] + if $TimeLimit.time_left > rank["time"]: + continue + + scoreLbl.text = letter + scoreLbl.add_theme_color_override("font_color", rank["color"]) + break + $TimeLimit.stop() is_active = false - func _on_area_area_exited(area: Area3D) -> void: if area.name == "PedestrianArea": pedestrian_area_count -= 1 diff --git a/player.tscn b/player.tscn index 01324a5..b6070a8 100644 --- a/player.tscn +++ b/player.tscn @@ -43,6 +43,10 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0) shape = SubResource("CylinderShape3D_i3pqv") debug_color = Color(0.41852123, 0.4635067, 0.996484, 0.41960785) +[node name="SpeedBoostTimer" type="Timer" parent="." unique_id=1248180543] +wait_time = 3.0 +one_shot = true + [node name="TimeLimit" type="Timer" parent="." unique_id=1568603467] wait_time = 60.0 one_shot = true @@ -101,7 +105,6 @@ offset_bottom = 4.0 grow_horizontal = 2 grow_vertical = 2 pivot_offset_ratio = Vector2(0.5, 0.5) -theme_override_colors/font_color = Color(1, 1, 1, 1) theme_override_font_sizes/font_size = 20 text = "Diners guanyat: Diners total:" diff --git a/station.tscn b/station.tscn index ae637d0..e37364c 100644 --- a/station.tscn +++ b/station.tscn @@ -68,7 +68,10 @@ height = 12.0 albedo_color = Color(0.32309133, 0.18083456, 0.02107518, 1) [sub_resource type="BoxShape3D" id="BoxShape3D_qalsi"] -size = Vector3(10.328461, 19.235413, 1) +size = Vector3(10.328461, 19.235413, 100.52051) + +[sub_resource type="BoxShape3D" id="BoxShape3D_sum1q"] +size = Vector3(16.840843, 19.235413, 1) [node name="Station" type="Node3D" unique_id=1195945545] script = ExtResource("1_lu35c") @@ -259,23 +262,19 @@ transform = Transform3D(1, 0, 0, 0, -4.371139e-08, -1, 0, 1, -4.371139e-08, 23.1 mesh = SubResource("CylinderMesh_oblqs") surface_material_override/0 = SubResource("StandardMaterial3D_72kuv") -[node name="StaticBody3D" type="StaticBody3D" parent="." unique_id=164550345] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 59.986458) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D" unique_id=302080513] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.37850952, 9.117706, 0) -shape = SubResource("BoxShape3D_qalsi") - -[node name="StaticBody3D2" type="StaticBody3D" parent="." unique_id=1827051563] +[node name="Walls" type="StaticBody3D" parent="." unique_id=1827051563] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -40.55725, 0, 59.986458) +collision_layer = 65535 +collision_mask = 65535 -[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D2" unique_id=1384700771] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.6307526, 9.117706, 0) +[node name="LeftWall" type="CollisionShape3D" parent="Walls" unique_id=1384700771] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.631, 9.118, -52.22) shape = SubResource("BoxShape3D_qalsi") -[node name="StaticBody3D3" type="StaticBody3D" parent="." unique_id=1781004061] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 48.200535, 0, 59.986458) +[node name="MiddleWall" type="CollisionShape3D" parent="Walls" unique_id=302080513] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 40.28652, 9.117706, 0) +shape = SubResource("BoxShape3D_sum1q") -[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D3" unique_id=1875610184] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.6307526, 9.117706, 0) +[node name="RightWall" type="CollisionShape3D" parent="Walls" unique_id=1875610184] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 85.126785, 9.118, -52.22) shape = SubResource("BoxShape3D_qalsi")