Major overhaul of scene transitions and game over

This commit is contained in:
2024-05-12 15:58:09 +01:00
parent 057cb42efe
commit 9a7484a687
19 changed files with 370 additions and 103 deletions

View File

@@ -12,7 +12,7 @@ void fragment() {
if ((COLOR.r > 0.8) && (COLOR.g > 0.8) && (COLOR.b < 0.2) && (COLOR.a > 0.9)) { if ((COLOR.r > 0.8) && (COLOR.g > 0.8) && (COLOR.b < 0.2) && (COLOR.a > 0.9)) {
vec2 actual_uv = (SCREEN_UV - rect_global_position) * rect_size; vec2 actual_uv = (SCREEN_UV - rect_global_position) * rect_size;
COLOR.rgb = texture(ColourTexture, actual_uv).rgb ; COLOR.rgb = texture(ColourTexture, actual_uv).rgb;
} }
// if (COLOR.rgba == vec4(1.0, 0.0, 1.0, 1.0)) { // if (COLOR.rgba == vec4(1.0, 0.0, 1.0, 1.0)) {
// if (COLOR.a > 0.9) { // if (COLOR.a > 0.9) {

View File

@@ -75,6 +75,8 @@ func _ready() -> void:
EventBus.update_score.connect(_on_update_score) EventBus.update_score.connect(_on_update_score)
new_level() new_level()
Music.play_game() Music.play_game()
var tween = get_tree().create_tween()
tween.tween_property($ColorRect, "color", Color(0, 0, 0, 0), 1)
var opened: bool = false var opened: bool = false
@@ -281,21 +283,26 @@ func _on_hit_floor(ball, _power) -> void:
if c is Upgrade: if c is Upgrade:
call_deferred("remove_child", c) call_deferred("remove_child", c)
c.call_deferred("queue_free") c.call_deferred("queue_free")
PaddleNode.normal()
ball = _Ball.instantiate()
ball.capture(PaddleNode, Vector2((randf() * 32) - 16, 8))
ball.hit_paddle.connect(_on_hit_paddle)
ball.hit_floor.connect(_on_hit_floor)
call_deferred("add_child", ball)
balls.push_back(ball)
Music.jingle_finished.connect(_on_start_round_finished)
Music.jingle(Music.JINGLE_LEVEL_START)
StartNode.visible = true
mode = MODE_WAIT
lives -= 1 lives -= 1
if lives <= 0: if lives <= 0:
get_tree().change_scene_to_file("res://GameOver.tscn") var tween = get_tree().create_tween()
tween.tween_property($ColorRect, "color", Color(0, 0, 0, 1), 2)
tween.finished.connect(_go_to_game_over)
else:
PaddleNode.normal()
ball = _Ball.instantiate()
ball.capture(PaddleNode, Vector2((randf() * 32) - 16, 8))
ball.hit_paddle.connect(_on_hit_paddle)
ball.hit_floor.connect(_on_hit_floor)
call_deferred("add_child", ball)
balls.push_back(ball)
StartNode.visible = true
mode = MODE_WAIT
Music.jingle_finished.connect(_on_start_round_finished)
Music.jingle(Music.JINGLE_LEVEL_START)
func _go_to_game_over() -> void:
get_tree().change_scene_to_file("res://GameOver.tscn")
func _on_round_won_finished() -> void: func _on_round_won_finished() -> void:
pass pass

View File

@@ -43,13 +43,13 @@ distance = -432.0
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_48dqy"] [sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_48dqy"]
distance = -360.0 distance = -360.0
[sub_resource type="ShaderMaterial" id="ShaderMaterial_bxn44"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_334al"]
shader = ExtResource("12_ljnes") shader = ExtResource("12_ljnes")
shader_parameter/rect_global_position = Vector2(0, 0) shader_parameter/rect_global_position = Vector2(0, 0.215385)
shader_parameter/rect_size = Vector2(150, 25) shader_parameter/rect_size = Vector2(448, 25)
shader_parameter/ColourTexture = ExtResource("13_u52d1") shader_parameter/ColourTexture = ExtResource("13_u52d1")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_37u5t"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_ldhlx"]
shader = ExtResource("12_ljnes") shader = ExtResource("12_ljnes")
shader_parameter/rect_global_position = Vector2(0, 0) shader_parameter/rect_global_position = Vector2(0, 0)
shader_parameter/rect_size = Vector2(89, 25) shader_parameter/rect_size = Vector2(89, 25)
@@ -323,7 +323,7 @@ theme_type_variation = &"RoundStart"
layout_mode = 2 layout_mode = 2
[node name="Title" type="Label" parent="Start/VBoxContainer/PanelContainer/VBoxContainer"] [node name="Title" type="Label" parent="Start/VBoxContainer/PanelContainer/VBoxContainer"]
material = SubResource("ShaderMaterial_bxn44") material = SubResource("ShaderMaterial_334al")
layout_mode = 2 layout_mode = 2
theme = ExtResource("8_wcf7g") theme = ExtResource("8_wcf7g")
theme_type_variation = &"Arkanoid" theme_type_variation = &"Arkanoid"
@@ -371,7 +371,7 @@ size_flags_vertical = 3
theme = ExtResource("8_wcf7g") theme = ExtResource("8_wcf7g")
[node name="Label" type="Label" parent="Paused/VBoxContainer"] [node name="Label" type="Label" parent="Paused/VBoxContainer"]
material = SubResource("ShaderMaterial_37u5t") material = SubResource("ShaderMaterial_ldhlx")
layout_mode = 2 layout_mode = 2
theme = ExtResource("8_wcf7g") theme = ExtResource("8_wcf7g")
theme_type_variation = &"Arkanoid" theme_type_variation = &"Arkanoid"
@@ -609,6 +609,12 @@ sprite_frames = ExtResource("26_ahhyt")
autoplay = "default" autoplay = "default"
centered = false centered = false
[node name="ColorRect" type="ColorRect" parent="."]
offset_right = 641.0
offset_bottom = 360.0
mouse_filter = 2
color = Color(0, 0, 0, 1)
[connection signal="update_lives" from="." to="." method="_on_update_lives"] [connection signal="update_lives" from="." to="." method="_on_update_lives"]
[connection signal="effect_finished" from="Paddle" to="." method="_on_paddle_effect_finished"] [connection signal="effect_finished" from="Paddle" to="." method="_on_paddle_effect_finished"]
[connection signal="pressed" from="Paused/VBoxContainer/HBoxContainer/Quit" to="Paused" method="_on_quit_pressed"] [connection signal="pressed" from="Paused/VBoxContainer/HBoxContainer/Quit" to="Paused" method="_on_quit_pressed"]

BIN
FadeTex.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 715 B

34
FadeTex.png.import Normal file
View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c6nwmsoi1gjvv"
path="res://.godot/imported/FadeTex.png-ab08c20492450576951a91a167d165af.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://FadeTex.png"
dest_files=["res://.godot/imported/FadeTex.png-ab08c20492450576951a91a167d165af.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

View File

@@ -3,15 +3,34 @@ extends Node2D
func _ready() -> void: func _ready() -> void:
EventBus.update_score.connect(_on_update_score) EventBus.update_score.connect(_on_update_score)
_on_update_score(Global.score) _on_update_score(Global.score)
Music.play_intro() Music.play_game_over()
Music.jingle(Music.JINGLE_GAME_OVER) var tween = get_tree().create_tween()
tween.tween_property($ColorRect, "color", Color(0, 0, 0, 0), 2)
func _on_timer_timeout() -> void: func _process(_delta : float) -> void:
get_tree().change_scene_to_file("res://Intro.tscn") if Input.is_action_just_pressed("fire"):
var tween = get_tree().create_tween()
tween.tween_property($ColorRect, "color", Color(0, 0, 0, 1), 3)
tween.finished.connect(_wait_load_intro)
func _input(event: InputEvent) -> void:
if event is InputEventMouseButton:
if event.pressed:
var tween = get_tree().create_tween()
tween.tween_property($ColorRect, "color", Color(0, 0, 0, 1), 3)
tween.finished.connect(_wait_load_intro)
func _on_update_score(score : int) -> void: func _on_update_score(score : int) -> void:
$VBoxContainer/HBoxContainer/ScoreBox.text = "%08d" % score $VBoxContainer/HBoxContainer/ScoreBox.text = "%08d" % score
func _on_game_over_sound_finished() -> void: func _on_sub_viewport_container_scroll_finished() -> void:
get_tree().change_scene_to_file("res://Intro.tscn") var tween = get_tree().create_tween()
tween.tween_property($ColorRect, "color", Color(0, 0, 0, 1), 3)
tween.finished.connect(_wait_load_intro)
func _wait_load_intro() -> void:
get_tree().create_timer(3).timeout.connect(_load_intro)
func _load_intro() -> void:
get_tree().change_scene_to_file("res://Intro.tscn")

14
GameOver.gdshader Normal file
View File

@@ -0,0 +1,14 @@
shader_type canvas_item;
void vertex() {
// Called for every vertex the material is visible on.
}
void fragment() {
// Called for every pixel the material is visible on.
}
//void light() {
// Called for every pixel for every light affecting the CanvasItem.
// Uncomment to replace the default light processing function with this one.
//}

View File

@@ -1,26 +1,30 @@
[gd_scene load_steps=7 format=3 uid="uid://c3ikcjhbrm0hp"] [gd_scene load_steps=11 format=3 uid="uid://c3ikcjhbrm0hp"]
[ext_resource type="Script" path="res://GameOver.gd" id="1_clfqa"] [ext_resource type="Script" path="res://GameOver.gd" id="1_clfqa"]
[ext_resource type="Theme" uid="uid://cfvww0geatnnk" path="res://MainTheme.tres" id="3_km2fx"] [ext_resource type="Theme" uid="uid://cfvww0geatnnk" path="res://MainTheme.tres" id="3_km2fx"]
[ext_resource type="Shader" path="res://Arkanoid.gdshader" id="3_u76hk"] [ext_resource type="Shader" path="res://Arkanoid.gdshader" id="3_u76hk"]
[ext_resource type="Texture2D" uid="uid://b56kjbt4ub52n" path="res://NoidTex.png" id="4_lxs2b"] [ext_resource type="Texture2D" uid="uid://b56kjbt4ub52n" path="res://NoidTex.png" id="4_lxs2b"]
[ext_resource type="Script" path="res://ArkaLabel.gd" id="5_g14o8"] [ext_resource type="Script" path="res://ArkaLabel.gd" id="5_g14o8"]
[ext_resource type="Shader" path="res://ScrollText.gdshader" id="6_t71ub"]
[ext_resource type="Script" path="res://ScrollText.gd" id="6_y6ajf"]
[ext_resource type="Texture2D" uid="uid://c6nwmsoi1gjvv" path="res://FadeTex.png" id="7_wpqjt"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ne3hd"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_sdln7"]
shader = ExtResource("3_u76hk") shader = ExtResource("3_u76hk")
shader_parameter/rect_global_position = Vector2(0, 0) shader_parameter/rect_global_position = Vector2(0, 0.104895)
shader_parameter/rect_size = Vector2(160, 25) shader_parameter/rect_size = Vector2(640, 25)
shader_parameter/ColourTexture = ExtResource("4_lxs2b") shader_parameter/ColourTexture = ExtResource("4_lxs2b")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_fxm16"]
shader = ExtResource("6_t71ub")
shader_parameter/rect_global_position = Vector2(0.5, 0.37)
shader_parameter/rect_size = Vector2(211, 96)
shader_parameter/ColourTexture = ExtResource("7_wpqjt")
[node name="GameOver" type="Node2D"] [node name="GameOver" type="Node2D"]
texture_filter = 1 texture_filter = 1
script = ExtResource("1_clfqa") script = ExtResource("1_clfqa")
[node name="Timer" type="Timer" parent="."]
wait_time = 10.0
one_shot = true
autostart = true
[node name="VBoxContainer" type="VBoxContainer" parent="."] [node name="VBoxContainer" type="VBoxContainer" parent="."]
offset_right = 640.0 offset_right = 640.0
offset_bottom = 360.0 offset_bottom = 360.0
@@ -31,7 +35,7 @@ size_flags_vertical = 3
theme = ExtResource("3_km2fx") theme = ExtResource("3_km2fx")
[node name="GameOver" type="Label" parent="VBoxContainer"] [node name="GameOver" type="Label" parent="VBoxContainer"]
material = SubResource("ShaderMaterial_ne3hd") material = SubResource("ShaderMaterial_sdln7")
layout_mode = 2 layout_mode = 2
theme = ExtResource("3_km2fx") theme = ExtResource("3_km2fx")
theme_type_variation = &"Arkanoid" theme_type_variation = &"Arkanoid"
@@ -40,11 +44,6 @@ horizontal_alignment = 1
vertical_alignment = 1 vertical_alignment = 1
script = ExtResource("5_g14o8") script = ExtResource("5_g14o8")
[node name="VSeparator2" type="VSeparator" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
theme = ExtResource("3_km2fx")
[node name="ScoreLabel" type="Label" parent="VBoxContainer"] [node name="ScoreLabel" type="Label" parent="VBoxContainer"]
layout_mode = 2 layout_mode = 2
theme = ExtResource("3_km2fx") theme = ExtResource("3_km2fx")
@@ -78,4 +77,93 @@ layout_mode = 2
size_flags_vertical = 3 size_flags_vertical = 3
theme = ExtResource("3_km2fx") theme = ExtResource("3_km2fx")
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"] [node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/HBoxContainer2"]
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("3_km2fx")
[node name="SubViewportContainer" type="SubViewportContainer" parent="VBoxContainer/HBoxContainer2"]
material = SubResource("ShaderMaterial_fxm16")
clip_contents = true
layout_mode = 2
size_flags_horizontal = 3
stretch = true
script = ExtResource("6_y6ajf")
[node name="SubViewport" type="SubViewport" parent="VBoxContainer/HBoxContainer2/SubViewportContainer"]
disable_3d = true
transparent_bg = true
handle_input_locally = false
size = Vector2i(211, 71)
render_target_update_mode = 4
[node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer/HBoxContainer2/SubViewportContainer/SubViewport"]
custom_minimum_size = Vector2(211, 96)
offset_right = 40.0
offset_bottom = 40.0
size_flags_horizontal = 3
size_flags_vertical = 3
horizontal_scroll_mode = 0
vertical_scroll_mode = 3
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer2/SubViewportContainer/SubViewport/ScrollContainer"]
custom_minimum_size = Vector2(211, 96)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
theme = ExtResource("3_km2fx")
text = "
For you, the war is over.
Countless have died on both sides of the conflict.
And now, without you to lead them, countless more will die.
The fate of humanity, or what is left of humanity, is now sealed.
"
horizontal_alignment = 1
autowrap_mode = 3
[node name="HSeparator2" type="HSeparator" parent="VBoxContainer/HBoxContainer2"]
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("3_km2fx")
[node name="VSeparator4" type="VSeparator" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
theme = ExtResource("3_km2fx")
[node name="ColorRect" type="ColorRect" parent="."]
offset_right = 640.0
offset_bottom = 360.0
mouse_filter = 2
color = Color(0, 0, 0, 1)
[connection signal="scroll_finished" from="VBoxContainer/HBoxContainer2/SubViewportContainer" to="." method="_on_sub_viewport_container_scroll_finished"]

View File

@@ -92,6 +92,8 @@ var Bricks : Dictionary = {
var start_level : String = "DUNKANOID" var start_level : String = "DUNKANOID"
var _loading : bool = false var _loading : bool = false
var MainTheme = preload("res://MainTheme.tres")
func _ready() -> void: func _ready() -> void:
_loading = true _loading = true
load_backgrounds() load_backgrounds()

View File

@@ -23,6 +23,8 @@ func _ready() -> void:
$VBoxContainer/Play/VBoxContainer/Play.grab_focus() $VBoxContainer/Play/VBoxContainer/Play.grab_focus()
Music.play_intro() Music.play_intro()
get_tree().create_timer(5).timeout.connect(_show_credits) get_tree().create_timer(5).timeout.connect(_show_credits)
var tween = get_tree().create_tween()
tween.tween_property($ColorRect, "color", Color(0, 0, 0, 0), 1)
func _show_credits() -> void: func _show_credits() -> void:
$HBoxContainer/Credits/CreditsRole.modulate = Color(0, 0, 0, 0) $HBoxContainer/Credits/CreditsRole.modulate = Color(0, 0, 0, 0)
@@ -49,9 +51,7 @@ func _hide_credits() -> void:
func _hide_credits_done() -> void: func _hide_credits_done() -> void:
get_tree().create_timer(1).timeout.connect(_show_credits) get_tree().create_timer(1).timeout.connect(_show_credits)
func _on_button_pressed() -> void:
Global.start_level = "DUNKANOID"
get_tree().change_scene_to_file("res://Dunkanoid.tscn")
func _on_update_score(score : int) -> void: func _on_update_score(score : int) -> void:
@@ -86,8 +86,18 @@ func _on_play_level_pressed() -> void:
func _on_load_panel_load_level(level_name: String) -> void: func _on_load_panel_load_level(level_name: String) -> void:
Global.start_level = level_name Global.start_level = level_name
var tween = get_tree().create_tween()
tween.tween_property($ColorRect, "color", Color(0, 0, 0, 1), 1)
tween.finished.connect(_start_game)
func _start_game() -> void:
get_tree().change_scene_to_file("res://Dunkanoid.tscn") get_tree().change_scene_to_file("res://Dunkanoid.tscn")
func _on_button_pressed() -> void:
Global.start_level = "DUNKANOID"
var tween = get_tree().create_tween()
tween.tween_property($ColorRect, "color", Color(0, 0, 0, 1), 1)
tween.finished.connect(_start_game)
func _on_upgrades_pressed() -> void: func _on_upgrades_pressed() -> void:
get_tree().change_scene_to_file("res://Upgrades.tscn") get_tree().change_scene_to_file("res://Upgrades.tscn")

View File

@@ -20,15 +20,15 @@ point_count = 2
[sub_resource type="Gradient" id="Gradient_431mb"] [sub_resource type="Gradient" id="Gradient_431mb"]
colors = PackedColorArray(0, 0, 0, 0, 1, 1, 1, 1) colors = PackedColorArray(0, 0, 0, 0, 1, 1, 1, 1)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_coeve"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_jnv6c"]
shader = ExtResource("3_eo4f3") shader = ExtResource("3_eo4f3")
shader_parameter/rect_global_position = Vector2(0, 0) shader_parameter/rect_global_position = Vector2(0.19822, 0.0769231)
shader_parameter/rect_size = Vector2(150, 25) shader_parameter/rect_size = Vector2(150, 25)
shader_parameter/ColourTexture = ExtResource("4_v8i0c") shader_parameter/ColourTexture = ExtResource("4_v8i0c")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_04r5o"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_u0aoy"]
shader = ExtResource("3_eo4f3") shader = ExtResource("3_eo4f3")
shader_parameter/rect_global_position = Vector2(0, 0) shader_parameter/rect_global_position = Vector2(0.161003, 0.117483)
shader_parameter/rect_size = Vector2(242, 25) shader_parameter/rect_size = Vector2(242, 25)
shader_parameter/ColourTexture = ExtResource("4_v8i0c") shader_parameter/ColourTexture = ExtResource("4_v8i0c")
@@ -70,7 +70,7 @@ size_flags_horizontal = 3
theme = ExtResource("3_8d2ix") theme = ExtResource("3_8d2ix")
[node name="ArkaLabel" type="Label" parent="VBoxContainer/HBoxContainer"] [node name="ArkaLabel" type="Label" parent="VBoxContainer/HBoxContainer"]
material = SubResource("ShaderMaterial_coeve") material = SubResource("ShaderMaterial_jnv6c")
layout_mode = 2 layout_mode = 2
theme = ExtResource("3_8d2ix") theme = ExtResource("3_8d2ix")
theme_type_variation = &"Arkanoid" theme_type_variation = &"Arkanoid"
@@ -91,7 +91,7 @@ size_flags_horizontal = 3
theme = ExtResource("3_8d2ix") theme = ExtResource("3_8d2ix")
[node name="Revenge" type="Label" parent="VBoxContainer/HBoxContainer2"] [node name="Revenge" type="Label" parent="VBoxContainer/HBoxContainer2"]
material = SubResource("ShaderMaterial_04r5o") material = SubResource("ShaderMaterial_u0aoy")
layout_mode = 2 layout_mode = 2
theme = ExtResource("3_8d2ix") theme = ExtResource("3_8d2ix")
theme_type_variation = &"Arkanoid" theme_type_variation = &"Arkanoid"
@@ -295,6 +295,12 @@ text = "00:00.00"
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1 vertical_alignment = 1
[node name="ColorRect" type="ColorRect" parent="."]
offset_right = 640.0
offset_bottom = 360.0
mouse_filter = 2
color = Color(0, 0, 0, 1)
[connection signal="pressed" from="VBoxContainer/Play/VBoxContainer/Play" to="." method="_on_button_pressed"] [connection signal="pressed" from="VBoxContainer/Play/VBoxContainer/Play" to="." method="_on_button_pressed"]
[connection signal="pressed" from="VBoxContainer/Play/VBoxContainer/PlayLevel" to="." method="_on_play_level_pressed"] [connection signal="pressed" from="VBoxContainer/Play/VBoxContainer/PlayLevel" to="." method="_on_play_level_pressed"]
[connection signal="pressed" from="VBoxContainer/Play/VBoxContainer/Upgrades" to="." method="_on_upgrades_pressed"] [connection signal="pressed" from="VBoxContainer/Play/VBoxContainer/Upgrades" to="." method="_on_upgrades_pressed"]

View File

@@ -129,6 +129,16 @@ Numbers/styles/normal = SubResource("StyleBoxFlat_8xhb1")
OptionButton/fonts/font = ExtResource("2_04xve") OptionButton/fonts/font = ExtResource("2_04xve")
PanelContainer/styles/panel = SubResource("StyleBoxFlat_sf0ln") PanelContainer/styles/panel = SubResource("StyleBoxFlat_sf0ln")
PopupMenu/fonts/font = ExtResource("2_04xve") PopupMenu/fonts/font = ExtResource("2_04xve")
RichTextLabel/font_sizes/bold_font_size = 8
RichTextLabel/font_sizes/bold_italics_font_size = 8
RichTextLabel/font_sizes/italics_font_size = 8
RichTextLabel/font_sizes/mono_font_size = 8
RichTextLabel/font_sizes/normal_font_size = 8
RichTextLabel/fonts/bold_font = ExtResource("3_fjg1d")
RichTextLabel/fonts/bold_italics_font = ExtResource("3_fjg1d")
RichTextLabel/fonts/italics_font = ExtResource("3_fjg1d")
RichTextLabel/fonts/mono_font = ExtResource("2_04xve")
RichTextLabel/fonts/normal_font = ExtResource("2_04xve")
RoundStart/base_type = &"PanelContainer" RoundStart/base_type = &"PanelContainer"
RoundStart/styles/panel = SubResource("StyleBoxFlat_mruxx") RoundStart/styles/panel = SubResource("StyleBoxFlat_mruxx")
SmallLabel/base_type = &"Label" SmallLabel/base_type = &"Label"

View File

@@ -4,7 +4,8 @@ var MusicPlayer : AudioStreamPlayer
enum { enum {
MUSIC_INTRO, MUSIC_INTRO,
MUSIC_GAME MUSIC_GAME,
MUSIC_GAME_OVER
} }
enum { enum {
@@ -18,8 +19,12 @@ signal jingle_finished(type : int)
var music : int = MUSIC_INTRO var music : int = MUSIC_INTRO
var pausepos : float = 0 var pausepos : float = 0
var MusicFileIntro = preload("res://Music/Through The Crystal - Jeremy Blake.mp3") var MP3 : Dictionary = {
var MusicFileGame = preload("res://Music/Powerup! - Jeremy Blake.mp3") "Through The Crystal": preload("res://Music/Through The Crystal - Jeremy Blake.mp3"),
"Powerup": preload("res://Music/Powerup! - Jeremy Blake.mp3"),
"Absolutely Nothing" : preload("res://Music/Absolutely Nothing - Jeremy Blake.mp3"),
"I'll Remember You": preload("res://Music/I'll Remember You - Jeremy Blake.mp3")
}
var JingleFileStart = preload("res://Sounds/Start.wav") var JingleFileStart = preload("res://Sounds/Start.wav")
var JingleFileWin = preload("res://Sounds/Win.wav") var JingleFileWin = preload("res://Sounds/Win.wav")
@@ -34,7 +39,7 @@ func _ready() -> void:
MusicPlayer.bus = "Music" MusicPlayer.bus = "Music"
MusicPlayer.process_mode = Node.PROCESS_MODE_ALWAYS MusicPlayer.process_mode = Node.PROCESS_MODE_ALWAYS
add_child(MusicPlayer) add_child(MusicPlayer)
MusicPlayer.stream = MusicFileIntro MusicPlayer.stream = MP3["Through The Crystal"]
MusicPlayer.play() MusicPlayer.play()
music = MUSIC_INTRO music = MUSIC_INTRO
@@ -44,7 +49,7 @@ func play_game() -> void:
if jingle_playing: if jingle_playing:
pausepos = 0 pausepos = 0
else: else:
MusicPlayer.stream = MusicFileGame MusicPlayer.stream = MP3["Powerup"]
MusicPlayer.play() MusicPlayer.play()
music = MUSIC_GAME music = MUSIC_GAME
@@ -54,10 +59,20 @@ func play_intro() -> void:
if jingle_playing: if jingle_playing:
pausepos = 0 pausepos = 0
else: else:
MusicPlayer.stream = MusicFileIntro MusicPlayer.stream = MP3["Through The Crystal"]
MusicPlayer.play() MusicPlayer.play()
music = MUSIC_INTRO music = MUSIC_INTRO
func play_game_over() -> void:
if music == MUSIC_GAME_OVER:
return
if jingle_playing:
pausepos = 0
else:
MusicPlayer.stream = MP3["I'll Remember You"]
MusicPlayer.play()
music = MUSIC_GAME_OVER
func pause() -> void: func pause() -> void:
pausepos = MusicPlayer.get_playback_position() pausepos = MusicPlayer.get_playback_position()
MusicPlayer.stop() MusicPlayer.stop()
@@ -86,9 +101,11 @@ func _jingle_done() -> void:
MusicPlayer.finished.disconnect(_jingle_done) MusicPlayer.finished.disconnect(_jingle_done)
match music: match music:
MUSIC_INTRO: MUSIC_INTRO:
MusicPlayer.stream = MusicFileIntro MusicPlayer.stream = MP3["Through The Crystal"]
MUSIC_GAME: MUSIC_GAME:
MusicPlayer.stream = MusicFileGame MusicPlayer.stream = MP3["Powerup"]
MUSIC_GAME_OVER:
MusicPlayer.stream = MP3["I'll Remember You"]
resume() resume()
jingle_playing = false jingle_playing = false
jingle_finished.emit(jingle_number) jingle_finished.emit(jingle_number)

Binary file not shown.

View File

@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://vi5k4w8klmdb"
path="res://.godot/imported/I'll Remember You - Jeremy Blake.mp3-e39490dc4200e439788e8a18c9007047.mp3str"
[deps]
source_file="res://Music/I'll Remember You - Jeremy Blake.mp3"
dest_files=["res://.godot/imported/I'll Remember You - Jeremy Blake.mp3-e39490dc4200e439788e8a18c9007047.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

34
ScrollText.gd Normal file
View File

@@ -0,0 +1,34 @@
@tool
extends SubViewportContainer
var count : float = 0
signal scroll_finished
@export var Dummy : int = 0 :
set(x):
Dummy = x
_notification(NOTIFICATION_TRANSFORM_CHANGED)
func _ready() -> void:
$SubViewport/ScrollContainer.scroll_vertical = 0
set_notify_transform(true)
material.set_shader_parameter("rect_global_position", global_position / get_viewport_rect().size)
material.set_shader_parameter("rect_size", get_rect().size / get_viewport_rect().size * 24)
func _process(delta : float) -> void:
if Engine.is_editor_hint() == false:
count += delta
if count >= 0.1:
count -= 0.1
$SubViewport/ScrollContainer.scroll_vertical += 1
var vbar = $SubViewport/ScrollContainer.get_v_scroll_bar()
if vbar.value >= vbar.max_value - $SubViewport/ScrollContainer.size.y:
scroll_finished.emit()
func _notification(what: int) -> void:
if what == NOTIFICATION_TRANSFORM_CHANGED:
var pos = global_position / get_viewport_rect().size
material.set_shader_parameter("rect_global_position", pos)
material.set_shader_parameter("rect_size", get_rect().size / get_viewport_rect().size * 24)

13
ScrollText.gdshader Normal file
View File

@@ -0,0 +1,13 @@
shader_type canvas_item;
uniform sampler2D ColourTexture;
uniform vec2 rect_global_position;
uniform vec2 rect_size;
void vertex() {
}
void fragment() {
vec2 actual_uv = (SCREEN_UV - rect_global_position) * rect_size;
COLOR *= texture(ColourTexture, actual_uv);
}

View File

@@ -18,10 +18,10 @@ point_count = 2
[sub_resource type="Gradient" id="Gradient_ucorl"] [sub_resource type="Gradient" id="Gradient_ucorl"]
colors = PackedColorArray(0, 0, 0, 0, 1, 1, 1, 1) colors = PackedColorArray(0, 0, 0, 0, 1, 1, 1, 1)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_0g7aw"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_ttnt2"]
shader = ExtResource("4_waenw") shader = ExtResource("4_waenw")
shader_parameter/rect_global_position = Vector2(8, 8) shader_parameter/rect_global_position = Vector2(0.012945, 0.048951)
shader_parameter/rect_size = Vector2(127, 25) shader_parameter/rect_size = Vector2(608, 25)
shader_parameter/ColourTexture = ExtResource("5_y0x1p") shader_parameter/ColourTexture = ExtResource("5_y0x1p")
[node name="Upgrades" type="Node2D"] [node name="Upgrades" type="Node2D"]
@@ -76,7 +76,7 @@ autoplay = "default"
centered = false centered = false
[node name="ArkaLabel" type="Label" parent="VBoxContainer"] [node name="ArkaLabel" type="Label" parent="VBoxContainer"]
material = SubResource("ShaderMaterial_0g7aw") material = SubResource("ShaderMaterial_ttnt2")
layout_mode = 2 layout_mode = 2
size_flags_vertical = 6 size_flags_vertical = 6
theme = ExtResource("1_rv7oa") theme = ExtResource("1_rv7oa")
@@ -86,72 +86,60 @@ horizontal_alignment = 1
vertical_alignment = 1 vertical_alignment = 1
script = ExtResource("6_ducwl") script = ExtResource("6_ducwl")
[node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer"] [node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
custom_minimum_size = Vector2(0, 160)
layout_mode = 2 layout_mode = 2
size_flags_vertical = 3 size_flags_vertical = 3
follow_focus = true
vertical_scroll_mode = 0
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/ScrollContainer"] [node name="HSeparator" type="HSeparator" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
[node name="HSeparator" type="HSeparator" parent="VBoxContainer/ScrollContainer/HBoxContainer"]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
theme = ExtResource("1_rv7oa") theme = ExtResource("1_rv7oa")
[node name="EffectTime" parent="VBoxContainer/ScrollContainer/HBoxContainer" instance=ExtResource("4_rlh0r")] [node name="EffectTime" parent="VBoxContainer/HBoxContainer" instance=ExtResource("4_rlh0r")]
layout_mode = 2 layout_mode = 2
Name = "Effect Time" Name = "Effect Time"
GlobalVariable = "effect_time" GlobalVariable = "effect_time"
Description = "Increases how long powerup effects last for" Description = "Increases how long powerup effects last for"
[node name="HSeparator2" type="HSeparator" parent="VBoxContainer/ScrollContainer/HBoxContainer"] [node name="EffectChance" parent="VBoxContainer/HBoxContainer" instance=ExtResource("4_rlh0r")]
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("1_rv7oa")
[node name="EffectChance" parent="VBoxContainer/ScrollContainer/HBoxContainer" instance=ExtResource("4_rlh0r")]
layout_mode = 2 layout_mode = 2
Name = "Effect Chance" Name = "Effect Chance"
GlobalVariable = "powerup_percent" GlobalVariable = "powerup_percent"
Description = "Increases the chance that a powerup will drop when a block is destroyed" Description = "Increases the chance that a powerup will drop when a block is destroyed"
[node name="HSeparator3" type="HSeparator" parent="VBoxContainer/ScrollContainer/HBoxContainer"] [node name="LaserPower" parent="VBoxContainer/HBoxContainer" instance=ExtResource("4_rlh0r")]
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("1_rv7oa")
[node name="LaserPower" parent="VBoxContainer/ScrollContainer/HBoxContainer" instance=ExtResource("4_rlh0r")]
layout_mode = 2 layout_mode = 2
Name = "Laser Power" Name = "Laser Power"
GlobalVariable = "laser_power" GlobalVariable = "laser_power"
Description = "Increase the amount of damage the lasers do" Description = "Increase the amount of damage the lasers do"
[node name="HSeparator4" type="HSeparator" parent="VBoxContainer/ScrollContainer/HBoxContainer"] [node name="HSeparator2" type="HSeparator" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
theme = ExtResource("1_rv7oa") theme = ExtResource("1_rv7oa")
[node name="Lives" parent="VBoxContainer/ScrollContainer/HBoxContainer" instance=ExtResource("4_rlh0r")] [node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
[node name="HSeparator3" type="HSeparator" parent="VBoxContainer/HBoxContainer2"]
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("1_rv7oa")
[node name="Lives" parent="VBoxContainer/HBoxContainer2" instance=ExtResource("4_rlh0r")]
layout_mode = 2 layout_mode = 2
Name = "Lives" Name = "Lives"
GlobalVariable = "extra_lives" GlobalVariable = "extra_lives"
Description = "More lives!" Description = "More lives!"
[node name="HSeparator5" type="HSeparator" parent="VBoxContainer/ScrollContainer/HBoxContainer"] [node name="Split" parent="VBoxContainer/HBoxContainer2" instance=ExtResource("4_rlh0r")]
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("1_rv7oa")
[node name="Split" parent="VBoxContainer/ScrollContainer/HBoxContainer" instance=ExtResource("4_rlh0r")]
layout_mode = 2 layout_mode = 2
Name = "Split" Name = "Split"
GlobalVariable = "ball_split" GlobalVariable = "ball_split"
Description = "How many balls the D powerup splits the ball into" Description = "How many balls the D powerup splits the ball into"
[node name="HSeparator6" type="HSeparator" parent="VBoxContainer/ScrollContainer/HBoxContainer"] [node name="HSeparator4" type="HSeparator" parent="VBoxContainer/HBoxContainer2"]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
theme = ExtResource("1_rv7oa") theme = ExtResource("1_rv7oa")
@@ -178,14 +166,14 @@ text = "EXIT"
script = ExtResource("8_frvhv") script = ExtResource("8_frvhv")
HoverVariant = "ButtonHover" HoverVariant = "ButtonHover"
[connection signal="mouse_enter" from="VBoxContainer/ScrollContainer/HBoxContainer/EffectTime" to="." method="_show_description"] [connection signal="mouse_enter" from="VBoxContainer/HBoxContainer/EffectTime" to="." method="_show_description"]
[connection signal="mouse_leave" from="VBoxContainer/ScrollContainer/HBoxContainer/EffectTime" to="." method="_hide_description"] [connection signal="mouse_leave" from="VBoxContainer/HBoxContainer/EffectTime" to="." method="_hide_description"]
[connection signal="mouse_enter" from="VBoxContainer/ScrollContainer/HBoxContainer/EffectChance" to="." method="_show_description"] [connection signal="mouse_enter" from="VBoxContainer/HBoxContainer/EffectChance" to="." method="_show_description"]
[connection signal="mouse_leave" from="VBoxContainer/ScrollContainer/HBoxContainer/EffectChance" to="." method="_hide_description"] [connection signal="mouse_leave" from="VBoxContainer/HBoxContainer/EffectChance" to="." method="_hide_description"]
[connection signal="mouse_enter" from="VBoxContainer/ScrollContainer/HBoxContainer/LaserPower" to="." method="_show_description"] [connection signal="mouse_enter" from="VBoxContainer/HBoxContainer/LaserPower" to="." method="_show_description"]
[connection signal="mouse_leave" from="VBoxContainer/ScrollContainer/HBoxContainer/LaserPower" to="." method="_hide_description"] [connection signal="mouse_leave" from="VBoxContainer/HBoxContainer/LaserPower" to="." method="_hide_description"]
[connection signal="mouse_enter" from="VBoxContainer/ScrollContainer/HBoxContainer/Lives" to="." method="_show_description"] [connection signal="mouse_enter" from="VBoxContainer/HBoxContainer2/Lives" to="." method="_show_description"]
[connection signal="mouse_leave" from="VBoxContainer/ScrollContainer/HBoxContainer/Lives" to="." method="_hide_description"] [connection signal="mouse_leave" from="VBoxContainer/HBoxContainer2/Lives" to="." method="_hide_description"]
[connection signal="mouse_enter" from="VBoxContainer/ScrollContainer/HBoxContainer/Split" to="." method="_show_description"] [connection signal="mouse_enter" from="VBoxContainer/HBoxContainer2/Split" to="." method="_show_description"]
[connection signal="mouse_leave" from="VBoxContainer/ScrollContainer/HBoxContainer/Split" to="." method="_hide_description"] [connection signal="mouse_leave" from="VBoxContainer/HBoxContainer2/Split" to="." method="_hide_description"]
[connection signal="pressed" from="VBoxContainer/Exit/Exit" to="." method="_on_exit_pressed"] [connection signal="pressed" from="VBoxContainer/Exit/Exit" to="." method="_on_exit_pressed"]

View File

@@ -11,7 +11,7 @@ config_version=5
[application] [application]
config/name="Dunkanoid" config/name="Dunkanoid"
config/version="0.9.6" config/version="1.0.0"
run/main_scene="res://Intro.tscn" run/main_scene="res://Intro.tscn"
config/features=PackedStringArray("4.2", "Forward Plus") config/features=PackedStringArray("4.2", "Forward Plus")
run/max_fps=30 run/max_fps=30