diff --git a/assets/music/Run-Amok(chosic.com).mp3 b/assets/music/Run-Amok(chosic.com).mp3 new file mode 100644 index 0000000..23b255a Binary files /dev/null and b/assets/music/Run-Amok(chosic.com).mp3 differ diff --git a/assets/music/Run-Amok(chosic.com).mp3.import b/assets/music/Run-Amok(chosic.com).mp3.import new file mode 100644 index 0000000..4c57a7d --- /dev/null +++ b/assets/music/Run-Amok(chosic.com).mp3.import @@ -0,0 +1,19 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +uid="uid://5da1smwywxdk" +path="res://.godot/imported/Run-Amok(chosic.com).mp3-4acd487c1e868789780d861bef0741e2.mp3str" + +[deps] + +source_file="res://assets/music/Run-Amok(chosic.com).mp3" +dest_files=["res://.godot/imported/Run-Amok(chosic.com).mp3-4acd487c1e868789780d861bef0741e2.mp3str"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/assets/music/sources.txt b/assets/music/sources.txt new file mode 100644 index 0000000..e2d19ee --- /dev/null +++ b/assets/music/sources.txt @@ -0,0 +1,4 @@ +Run-Amok(chosic.com).mp3 +- license: CC BY 3.0 +- source: https://www.chosic.com/download-audio/39324/ +- artist: Run Amok by Kevin MacLeod | https://incompetech.com/ diff --git a/entities/Player.gd b/entities/Player.gd index 57d37e7..e88d315 100644 --- a/entities/Player.gd +++ b/entities/Player.gd @@ -171,5 +171,5 @@ func on_drop_bomb(): explosion_stream_player.play() var bomb_emitter : BombEmitter = bomb_emitter_scene.instantiate() - bomb_emitter.global_position = global_position get_parent_node_3d().add_child(bomb_emitter) + bomb_emitter.global_position = global_position diff --git a/scenes/Game.tscn b/scenes/Game.tscn index 360fd21..4228f69 100644 --- a/scenes/Game.tscn +++ b/scenes/Game.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=6 format=3 uid="uid://rd48gl8k5x34"] +[gd_scene load_steps=8 format=3 uid="uid://rd48gl8k5x34"] [ext_resource type="Theme" uid="uid://bb8mjy6l7umui" path="res://themes/GameUI.tres" id="2_eun58"] [ext_resource type="PackedScene" uid="uid://b1nm5h3yccr16" path="res://scenes/World.tscn" id="2_voimb"] @@ -9,6 +9,12 @@ [sub_resource type="ViewportTexture" id="ViewportTexture_2lmj8"] viewport_path = NodePath("Viewport") +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_y5ieh"] +bg_color = Color(1, 0, 0, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_obhii"] +bg_color = Color(0, 0, 1, 1) + [node name="Game" type="Node"] [node name="Viewport" type="SubViewport" parent="."] @@ -224,7 +230,6 @@ text = "0" horizontal_alignment = 1 [node name="GameRunningWidgets" type="Panel" parent="GameUI"] -visible = false custom_minimum_size = Vector2(0, 80) layout_mode = 1 anchors_preset = 10 @@ -240,16 +245,19 @@ alignment = 1 [node name="NameLabel" type="Label" parent="GameUI/GameRunningWidgets/Player1Widgets"] layout_mode = 2 +theme_override_colors/font_color = Color(1, 0, 0, 1) text = "Red" [node name="ScoreLabel" type="Label" parent="GameUI/GameRunningWidgets/Player1Widgets"] layout_mode = 2 +theme_override_colors/font_color = Color(1, 0, 0, 1) text = "0 " [node name="EnergyProgressBar" type="ProgressBar" parent="GameUI/GameRunningWidgets/Player1Widgets"] custom_minimum_size = Vector2(400, 0) layout_mode = 2 +theme_override_styles/fill = SubResource("StyleBoxFlat_y5ieh") value = 33.0 [node name="Player2Widgets" type="VBoxContainer" parent="GameUI/GameRunningWidgets"] @@ -262,16 +270,19 @@ alignment = 1 [node name="NameLabel" type="Label" parent="GameUI/GameRunningWidgets/Player2Widgets"] layout_mode = 2 +theme_override_colors/font_color = Color(0, 0, 1, 1) text = "Blue" [node name="ScoreLabel" type="Label" parent="GameUI/GameRunningWidgets/Player2Widgets"] layout_mode = 2 +theme_override_colors/font_color = Color(0, 0, 1, 1) text = "0 " [node name="EnergyProgressBar" type="ProgressBar" parent="GameUI/GameRunningWidgets/Player2Widgets"] custom_minimum_size = Vector2(400, 0) layout_mode = 2 +theme_override_styles/fill = SubResource("StyleBoxFlat_obhii") value = 75.0 [node name="TimeWidgets" type="VBoxContainer" parent="GameUI/GameRunningWidgets"] diff --git a/scenes/GameUI.gd b/scenes/GameUI.gd index 3f22171..49abe17 100644 --- a/scenes/GameUI.gd +++ b/scenes/GameUI.gd @@ -42,6 +42,10 @@ func _process(_delta): var milliseconds = floor((world.time_left - floor(world.time_left)) * 10) time_left_label.text = str(minutes) + ":" + str(seconds) + ":" + str(milliseconds) + + player1_score_label.add_theme_color_override("font-color", world.players[0].color) + if player2_widgets.visible: + player2_score_label.add_theme_color_override("font-color", world.players[1].color) elif world.game_state == World.GameState.Finished: game_startup_widgets.visible = false game_running_widgets.visible = false diff --git a/scenes/World.gd b/scenes/World.gd index 1c95f71..60a47f6 100644 --- a/scenes/World.gd +++ b/scenes/World.gd @@ -8,6 +8,7 @@ var players: Array @onready var camera: Camera3D = $Camera3D @onready var level: Node3D = $Level @onready var world_coloring_viewport: SubViewport = $WorldColoringViewport +@onready var music_stream_player: AudioStreamPlayer = $MusicAudioStreamPlayer var player_scene = preload("res://entities/Player.tscn") @@ -142,6 +143,7 @@ func spawn_players(): var players_node = $Players var player1: Player = player_scene.instantiate() + player1.name = "Red" player1.color = Color(1, 0, 0, 1) player1.coloring_sprite_path = world_coloring_viewport.get_node("Player1Sprite").get_path() player1.coloring_bomb_sprite_path = world_coloring_viewport.get_node("Player1BombSprite").get_path() @@ -152,6 +154,7 @@ func spawn_players(): player1.dash_action += "_p1" player1.bomb_action += "_p1" var player2: Player = player_scene.instantiate() + player1.name = "Blue" player2.color = Color(0, 0, 1, 1) player2.coloring_sprite_path = world_coloring_viewport.get_node("Player2Sprite").get_path() player2.coloring_bomb_sprite_path = world_coloring_viewport.get_node("Player2BombSprite").get_path() @@ -192,6 +195,8 @@ func on_game_startup(): print("Switching to startup") stop_gameplay() + music_stream_player.stop() + world_coloring_viewport.render_target_clear_mode = SubViewport.CLEAR_MODE_ONCE world_coloring_viewport.render_target_update_mode = SubViewport.UPDATE_ONCE @@ -199,6 +204,8 @@ func on_game_running(): print("Switching to gameplay") start_gameplay() + music_stream_player.play() + world_coloring_viewport.render_target_clear_mode = SubViewport.CLEAR_MODE_NEVER world_coloring_viewport.render_target_update_mode = SubViewport.UPDATE_ALWAYS diff --git a/scenes/World.tscn b/scenes/World.tscn index f0c57a1..7a540d7 100644 --- a/scenes/World.tscn +++ b/scenes/World.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=12 format=3 uid="uid://b1nm5h3yccr16"] +[gd_scene load_steps=13 format=3 uid="uid://b1nm5h3yccr16"] [ext_resource type="Script" path="res://scenes/World.gd" id="1_gtcjp"] +[ext_resource type="AudioStream" uid="uid://5da1smwywxdk" path="res://assets/music/Run-Amok(chosic.com).mp3" id="3_owwdt"] [ext_resource type="Texture2D" uid="uid://bnsrnuuq28p4d" path="res://assets/textures/player_draw_mask.png" id="4_dipd5"] [ext_resource type="Texture2D" uid="uid://vcebfpqo2ko7" path="res://assets/textures/player_bomb_mask.png" id="5_17c1g"] [ext_resource type="PackedScene" path="res://scenes/PixelCountComputeShader.tscn" id="6_75vqy"] @@ -32,6 +33,9 @@ autostart = true [node name="PixelCountComputeShader" parent="." instance=ExtResource("6_75vqy")] paint_viewport_path = NodePath("../WorldColoringViewport") +[node name="MusicAudioStreamPlayer" type="AudioStreamPlayer" parent="."] +stream = ExtResource("3_owwdt") + [node name="WorldEnvironment" type="WorldEnvironment" parent="."] environment = SubResource("Environment_f3jci")