Added music, best times, more backgrounds and more levels
This commit is contained in:
BIN
Backgrounds/BlueBlobs.png
Normal file
BIN
Backgrounds/BlueBlobs.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
34
Backgrounds/BlueBlobs.png.import
Normal file
34
Backgrounds/BlueBlobs.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://2nnbnni3o21e"
|
||||
path="res://.godot/imported/BlueBlobs.png-a39022144f831bfbd6952aa30a7507c4.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Backgrounds/BlueBlobs.png"
|
||||
dest_files=["res://.godot/imported/BlueBlobs.png-a39022144f831bfbd6952aa30a7507c4.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
|
||||
BIN
Backgrounds/Pipes.png
Normal file
BIN
Backgrounds/Pipes.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
34
Backgrounds/Pipes.png.import
Normal file
34
Backgrounds/Pipes.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://djflobjmdfwg4"
|
||||
path="res://.godot/imported/Pipes.png-93f56913d0805a589866718cd37099bb.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Backgrounds/Pipes.png"
|
||||
dest_files=["res://.godot/imported/Pipes.png-93f56913d0805a589866718cd37099bb.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
|
||||
@@ -38,13 +38,16 @@ shape = SubResource("CircleShape2D_nwcsc")
|
||||
|
||||
[node name="WallSound" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("3_bwkax")
|
||||
bus = &"Effects"
|
||||
|
||||
[node name="BrickSound" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("4_ly8mo")
|
||||
max_polyphony = 5
|
||||
bus = &"Effects"
|
||||
|
||||
[node name="PaddleSound" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("5_f8nt3")
|
||||
bus = &"Effects"
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
[connection signal="body_exited" from="." to="." method="_on_body_exited"]
|
||||
|
||||
73
Dunkanoid.gd
73
Dunkanoid.gd
@@ -26,12 +26,11 @@ var lives : int = 3 :
|
||||
update_lives.emit()
|
||||
|
||||
var level : String = "DUNKANOID"
|
||||
|
||||
var level_data : Dictionary = {}
|
||||
|
||||
var leave_direction : int = 0
|
||||
|
||||
var paused : bool = false
|
||||
var level_starting : bool = false
|
||||
var time_run : bool = false
|
||||
|
||||
func _ready() -> void:
|
||||
if Global.relative_mouse:
|
||||
@@ -41,18 +40,14 @@ func _ready() -> void:
|
||||
|
||||
EventBus.update_score.connect(_on_update_score)
|
||||
new_level()
|
||||
Music.play_game()
|
||||
|
||||
func _process(delta : float) -> void:
|
||||
|
||||
if OS.has_feature("editor"):
|
||||
if Input.is_action_just_pressed("cheat"):
|
||||
var upgrade = _Upgrade.instantiate()
|
||||
upgrade.position = balls[0].position
|
||||
upgrade.upgrade_collected.connect(_on_upgrade_collected)
|
||||
upgrade.set_upgrade("C", Color.BLUE)
|
||||
add_child(upgrade)
|
||||
#for i in 10:
|
||||
#add_ball()
|
||||
for i in 10:
|
||||
add_ball()
|
||||
|
||||
if mode == MODE_EXIT:
|
||||
if $Paddle.global_position.x - ($Paddle.width / 2) <= 20:
|
||||
@@ -65,7 +60,7 @@ func _process(delta : float) -> void:
|
||||
if mode == MODE_LEAVE:
|
||||
$Paddle.global_position.x += (delta * leave_direction * 20.0)
|
||||
if $Paddle.global_position.x < -16 or $Paddle.global_position.x > 428:
|
||||
if not $Sounds/RoundWon.playing:
|
||||
if not Music.jingle_playing:
|
||||
new_level()
|
||||
else:
|
||||
if Input.is_action_pressed("left"):
|
||||
@@ -82,16 +77,27 @@ func _process(delta : float) -> void:
|
||||
$Paddle.position.x = rightmost
|
||||
if Input.is_action_just_pressed("fire"):
|
||||
if mode == MODE_PLAY:
|
||||
if level_starting:
|
||||
level_starting = false
|
||||
$RunTimer.start()
|
||||
time_run = true
|
||||
for ball in balls:
|
||||
if (ball.captured):
|
||||
ball.release()
|
||||
|
||||
|
||||
if time_run:
|
||||
$ScoreCard/RunTime.text = "%02d:%05.2f" % [$RunTimer.elapsed_time / 60000, $RunTimer.elapsed_time % 60000 / 1000.0]
|
||||
|
||||
|
||||
func leave(dir : int) -> void:
|
||||
mode = MODE_LEAVE
|
||||
leave_direction = dir
|
||||
|
||||
func new_level() -> void:
|
||||
$NewBestTime.visible = false
|
||||
time_run = false
|
||||
level_starting = true
|
||||
$Paddle.normal()
|
||||
$Paddle.position.x = 224
|
||||
mode = MODE_WAIT
|
||||
@@ -106,10 +112,11 @@ func new_level() -> void:
|
||||
bricks.clear()
|
||||
chr += 1
|
||||
level_data = load_level_from_disk(level)
|
||||
|
||||
$Start/Title.text = level
|
||||
$Start/Round.text = "ROUND %3d" % [chr]
|
||||
$ScoreCard/BestTime.text = format_time(Global.get_best_time(level_data.name))
|
||||
$Start/VBoxContainer/PanelContainer/VBoxContainer/Title.text = level
|
||||
$Start/VBoxContainer/PanelContainer/VBoxContainer/Round.text = "ROUND %3d" % [chr]
|
||||
$Background.texture = load("res://Backgrounds/%s.png" % level_data.background)
|
||||
$Background.modulate = Color("#%s" % level_data.get("tint", "FFFFFF"))
|
||||
load_level(level_data.data)
|
||||
var ball = _Ball.instantiate()
|
||||
ball.capture($Paddle, Vector2((randf() * 32) - 16, 8))
|
||||
@@ -119,8 +126,8 @@ func new_level() -> void:
|
||||
balls.push_back(ball)
|
||||
|
||||
$Start.visible = true
|
||||
$Sounds/StartRound.play()
|
||||
|
||||
Music.jingle_finished.connect(_on_start_round_finished)
|
||||
Music.jingle(Music.JINGLE_LEVEL_START)
|
||||
|
||||
func _brick_destroyed(brick) -> void:
|
||||
Global.score += brick.value
|
||||
@@ -159,8 +166,21 @@ func _brick_destroyed(brick) -> void:
|
||||
|
||||
mode = MODE_EXIT
|
||||
$Exits.visible = true
|
||||
$Sounds/RoundWon.play()
|
||||
Music.jingle(Music.JINGLE_LEVEL_WON)
|
||||
var elapsed = $RunTimer.elapsed_time
|
||||
var best = Global.get_best_time(level_data.name)
|
||||
if elapsed < best:
|
||||
Global.set_best_time(level_data.name, elapsed)
|
||||
$RunTimer.pause()
|
||||
$NewBestTime/BestTime.text = format_time(elapsed)
|
||||
$NewBestTime.visible = true
|
||||
print($RunTimer.elapsed_time)
|
||||
|
||||
func format_time(time : int) -> String:
|
||||
print(time)
|
||||
if time > 3600000:
|
||||
return "--:--.--"
|
||||
return "%02d:%05.2f" % [time / 60000, time % 60000 / 1000.0]
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if paused:
|
||||
@@ -179,8 +199,12 @@ func _input(event: InputEvent) -> void:
|
||||
else:
|
||||
$Paddle.position = Vector2(min(max(16 + $Paddle.width/2, event.position.x), 432-$Paddle.width/2), 340)
|
||||
if event is InputEventMouseButton:
|
||||
if mode != MODE_PLAY:
|
||||
return
|
||||
if mode == MODE_PLAY:
|
||||
if level_starting:
|
||||
$RunTimer.start()
|
||||
level_starting = false
|
||||
time_run = true
|
||||
|
||||
for ball in balls:
|
||||
if (ball.captured):
|
||||
ball.release()
|
||||
@@ -207,7 +231,8 @@ func _on_hit_floor(ball) -> void:
|
||||
ball.hit_floor.connect(_on_hit_floor)
|
||||
add_child(ball)
|
||||
balls.push_back(ball)
|
||||
$Sounds/StartRound.play()
|
||||
Music.jingle_finished.connect(_on_start_round_finished)
|
||||
Music.jingle(Music.JINGLE_LEVEL_START)
|
||||
$Start.visible = true
|
||||
mode = MODE_WAIT
|
||||
lives -= 1
|
||||
@@ -220,7 +245,7 @@ func _on_round_won_finished() -> void:
|
||||
|
||||
|
||||
func _on_update_score(score) -> void:
|
||||
$ScoreBox.text = "%08d" % score
|
||||
$ScoreCard/ScoreBox.text = "%08d" % score
|
||||
pass # Replace with function body.
|
||||
|
||||
func _on_upgrade_collected(code : String) -> void:
|
||||
@@ -294,12 +319,14 @@ func load_level(data) -> void:
|
||||
brick.brick_destroyed.connect(_brick_destroyed)
|
||||
$Bricks.add_child(brick)
|
||||
|
||||
func _on_start_round_finished() -> void:
|
||||
func _on_start_round_finished(item : int) -> void:
|
||||
print("Jingle done")
|
||||
Music.jingle_finished.disconnect(_on_start_round_finished)
|
||||
$Start.visible = false
|
||||
mode = MODE_PLAY
|
||||
|
||||
func _on_update_lives() -> void:
|
||||
$LivesBox.text = "%d" % lives
|
||||
$ScoreCard/LivesBox.text = "%d" % lives
|
||||
|
||||
func load_level_from_disk(name : String) -> Dictionary:
|
||||
if FileAccess.file_exists("user://Levels/%s.json" % name):
|
||||
|
||||
253
Dunkanoid.tscn
253
Dunkanoid.tscn
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=18 format=3 uid="uid://4q0epdnb0x4s"]
|
||||
[gd_scene load_steps=17 format=3 uid="uid://4q0epdnb0x4s"]
|
||||
|
||||
[ext_resource type="Script" path="res://Dunkanoid.gd" id="1_kv4if"]
|
||||
[ext_resource type="PackedScene" uid="uid://dndemjw7up2r6" path="res://Paddle/Paddle.tscn" id="2_26c5i"]
|
||||
@@ -6,13 +6,12 @@
|
||||
[ext_resource type="Texture2D" uid="uid://3r13ufv5sq3w" path="res://Backgrounds/BlueSlash.png" id="5_j5mmn"]
|
||||
[ext_resource type="AudioStream" uid="uid://bkw4xksukx0dd" path="res://Sounds/Fail.wav" id="5_p5ta8"]
|
||||
[ext_resource type="Script" path="res://Floor.gd" id="5_sravy"]
|
||||
[ext_resource type="AudioStream" uid="uid://818gpo5mes22" path="res://Sounds/Start.wav" id="6_s0pha"]
|
||||
[ext_resource type="PhysicsMaterial" uid="uid://cql6t5hd40fgn" path="res://CorePhysics.tres" id="7_300m5"]
|
||||
[ext_resource type="AudioStream" uid="uid://bh2blx1uovmyt" path="res://Sounds/Win.wav" id="7_xrjor"]
|
||||
[ext_resource type="AudioStream" uid="uid://bojc0es7165ed" path="res://Sounds/Collected.wav" id="8_fpbsr"]
|
||||
[ext_resource type="Theme" uid="uid://cfvww0geatnnk" path="res://MainTheme.tres" id="8_wcf7g"]
|
||||
[ext_resource type="Material" uid="uid://bv4vhjg83fqpn" path="res://ArkanoidMaterial.tres" id="9_ouuij"]
|
||||
[ext_resource type="Script" path="res://Paused.gd" id="12_8qv0d"]
|
||||
[ext_resource type="Script" path="res://RunTimer.gd" id="12_nyw3s"]
|
||||
|
||||
[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_jsudl"]
|
||||
normal = Vector2(0, 1)
|
||||
@@ -71,57 +70,11 @@ shape = SubResource("WorldBoundaryShape2D_48dqy")
|
||||
|
||||
[node name="FloorSound" type="AudioStreamPlayer" parent="Sounds"]
|
||||
stream = ExtResource("5_p5ta8")
|
||||
|
||||
[node name="StartRound" type="AudioStreamPlayer" parent="Sounds"]
|
||||
stream = ExtResource("6_s0pha")
|
||||
|
||||
[node name="RoundWon" type="AudioStreamPlayer" parent="Sounds"]
|
||||
stream = ExtResource("7_xrjor")
|
||||
bus = &"Effects"
|
||||
|
||||
[node name="UpgradeCollected" type="AudioStreamPlayer" parent="Sounds"]
|
||||
stream = ExtResource("8_fpbsr")
|
||||
|
||||
[node name="ScoreLabel" type="Label" parent="."]
|
||||
offset_left = 448.0
|
||||
offset_top = 29.0
|
||||
offset_right = 639.0
|
||||
offset_bottom = 52.0
|
||||
theme = ExtResource("8_wcf7g")
|
||||
text = "SCORE"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="ScoreBox" type="Label" parent="."]
|
||||
offset_left = 448.0
|
||||
offset_top = 54.0
|
||||
offset_right = 639.0
|
||||
offset_bottom = 77.0
|
||||
theme = ExtResource("8_wcf7g")
|
||||
theme_type_variation = &"Numbers"
|
||||
text = "00000000"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="LivesLabel" type="Label" parent="."]
|
||||
offset_left = 448.0
|
||||
offset_top = 82.0
|
||||
offset_right = 639.0
|
||||
offset_bottom = 105.0
|
||||
theme = ExtResource("8_wcf7g")
|
||||
text = "LIVES"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="LivesBox" type="Label" parent="."]
|
||||
offset_left = 448.0
|
||||
offset_top = 105.0
|
||||
offset_right = 639.0
|
||||
offset_bottom = 128.0
|
||||
theme = ExtResource("8_wcf7g")
|
||||
theme_type_variation = &"Numbers"
|
||||
text = "3"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
bus = &"Effects"
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
offset_right = 16.0
|
||||
@@ -136,41 +89,6 @@ offset_bottom = 360.0
|
||||
offset_right = 432.0
|
||||
offset_bottom = 16.0
|
||||
|
||||
[node name="Start" type="Node2D" parent="."]
|
||||
z_index = 1
|
||||
|
||||
[node name="Title" type="Label" parent="Start"]
|
||||
material = ExtResource("9_ouuij")
|
||||
offset_left = 16.0
|
||||
offset_top = 199.0
|
||||
offset_right = 432.0
|
||||
offset_bottom = 224.0
|
||||
theme = ExtResource("8_wcf7g")
|
||||
theme_type_variation = &"Arkanoid"
|
||||
text = "DUNKANOID"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Round" type="Label" parent="Start"]
|
||||
offset_left = 16.0
|
||||
offset_top = 224.0
|
||||
offset_right = 432.0
|
||||
offset_bottom = 247.0
|
||||
theme = ExtResource("8_wcf7g")
|
||||
text = "ROUND 1"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Ready" type="Label" parent="Start"]
|
||||
offset_left = 16.0
|
||||
offset_top = 247.0
|
||||
offset_right = 432.0
|
||||
offset_bottom = 270.0
|
||||
theme = ExtResource("8_wcf7g")
|
||||
text = "READY"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Exits" type="Node2D" parent="."]
|
||||
|
||||
[node name="Left" type="ColorRect" parent="Exits"]
|
||||
@@ -195,6 +113,167 @@ color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Bricks" type="Node2D" parent="."]
|
||||
|
||||
[node name="RunTimer" type="Node" parent="."]
|
||||
script = ExtResource("12_nyw3s")
|
||||
|
||||
[node name="NewBestTime" type="VBoxContainer" parent="."]
|
||||
visible = false
|
||||
offset_right = 448.0
|
||||
offset_bottom = 360.0
|
||||
|
||||
[node name="VSeparator" type="VSeparator" parent="NewBestTime"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme = ExtResource("8_wcf7g")
|
||||
|
||||
[node name="NewBestTime" type="Label" parent="NewBestTime"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("8_wcf7g")
|
||||
text = "NEW BEST TIME"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="BestTime" type="Label" parent="NewBestTime"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("8_wcf7g")
|
||||
theme_type_variation = &"Numbers"
|
||||
text = "00:00"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="VSeparator2" type="VSeparator" parent="NewBestTime"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme = ExtResource("8_wcf7g")
|
||||
|
||||
[node name="ScoreCard" type="VBoxContainer" parent="."]
|
||||
offset_left = 448.0
|
||||
offset_top = 40.0
|
||||
offset_right = 640.0
|
||||
offset_bottom = 312.0
|
||||
|
||||
[node name="ScoreLabel" type="Label" parent="ScoreCard"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("8_wcf7g")
|
||||
text = "SCORE"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="ScoreBox" type="Label" parent="ScoreCard"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("8_wcf7g")
|
||||
theme_type_variation = &"Numbers"
|
||||
text = "00000000"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="VSeparator" type="VSeparator" parent="ScoreCard"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme = ExtResource("8_wcf7g")
|
||||
|
||||
[node name="LivesLabel" type="Label" parent="ScoreCard"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("8_wcf7g")
|
||||
text = "LIVES"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="LivesBox" type="Label" parent="ScoreCard"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("8_wcf7g")
|
||||
theme_type_variation = &"Numbers"
|
||||
text = "3"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="VSeparator2" type="VSeparator" parent="ScoreCard"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme = ExtResource("8_wcf7g")
|
||||
|
||||
[node name="RunLabel" type="Label" parent="ScoreCard"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("8_wcf7g")
|
||||
text = "TIME"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="RunTime" type="Label" parent="ScoreCard"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("8_wcf7g")
|
||||
theme_type_variation = &"Numbers"
|
||||
text = "00:00.00"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="VSeparator3" type="VSeparator" parent="ScoreCard"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme = ExtResource("8_wcf7g")
|
||||
|
||||
[node name="BestLabel" type="Label" parent="ScoreCard"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("8_wcf7g")
|
||||
text = "BEST TIME"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="BestTime" type="Label" parent="ScoreCard"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("8_wcf7g")
|
||||
theme_type_variation = &"Numbers"
|
||||
text = "00:00.00"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Start" type="Node2D" parent="."]
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Start"]
|
||||
offset_right = 448.0
|
||||
offset_bottom = 360.0
|
||||
|
||||
[node name="VSeparator" type="VSeparator" parent="Start/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme = ExtResource("8_wcf7g")
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="Start/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("8_wcf7g")
|
||||
theme_type_variation = &"RoundStart"
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Start/VBoxContainer/PanelContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Title" type="Label" parent="Start/VBoxContainer/PanelContainer/VBoxContainer"]
|
||||
material = ExtResource("9_ouuij")
|
||||
layout_mode = 2
|
||||
theme = ExtResource("8_wcf7g")
|
||||
theme_type_variation = &"Arkanoid"
|
||||
text = "DUNKANOID"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Round" type="Label" parent="Start/VBoxContainer/PanelContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("8_wcf7g")
|
||||
text = "ROUND 1"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Ready" type="Label" parent="Start/VBoxContainer/PanelContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("8_wcf7g")
|
||||
text = "READY"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="VSeparator2" type="VSeparator" parent="Start/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme = ExtResource("8_wcf7g")
|
||||
|
||||
[node name="Paused" type="Node2D" parent="."]
|
||||
process_mode = 3
|
||||
visible = false
|
||||
@@ -248,6 +327,4 @@ theme = ExtResource("8_wcf7g")
|
||||
|
||||
[connection signal="update_lives" from="." to="." method="_on_update_lives"]
|
||||
[connection signal="effect_finished" from="Paddle" to="." method="_on_paddle_effect_finished"]
|
||||
[connection signal="finished" from="Sounds/StartRound" to="." method="_on_start_round_finished"]
|
||||
[connection signal="finished" from="Sounds/RoundWon" to="." method="_on_round_won_finished"]
|
||||
[connection signal="pressed" from="Paused/VBoxContainer/HBoxContainer/Quit" to="Paused" method="_on_quit_pressed"]
|
||||
|
||||
@@ -2,3 +2,5 @@ extends Node
|
||||
|
||||
signal update_score(score : int)
|
||||
signal update_highscore(score : int)
|
||||
signal paused
|
||||
signal unpaused
|
||||
|
||||
@@ -3,6 +3,8 @@ extends Node2D
|
||||
func _ready() -> void:
|
||||
EventBus.update_score.connect(_on_update_score)
|
||||
_on_update_score(Global.score)
|
||||
Music.play_intro()
|
||||
Music.jingle(Music.JINGLE_GAME_OVER)
|
||||
|
||||
func _on_timer_timeout() -> void:
|
||||
get_tree().change_scene_to_file("res://Intro.tscn")
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://c3ikcjhbrm0hp"]
|
||||
[gd_scene load_steps=4 format=3 uid="uid://c3ikcjhbrm0hp"]
|
||||
|
||||
[ext_resource type="Script" path="res://GameOver.gd" id="1_clfqa"]
|
||||
[ext_resource type="AudioStream" uid="uid://bm1txhcguq8e1" path="res://Sounds/GameOver.wav" id="2_a07oi"]
|
||||
[ext_resource type="Theme" uid="uid://cfvww0geatnnk" path="res://MainTheme.tres" id="3_km2fx"]
|
||||
[ext_resource type="Material" uid="uid://bv4vhjg83fqpn" path="res://ArkanoidMaterial.tres" id="4_et3vd"]
|
||||
|
||||
@@ -9,10 +8,6 @@
|
||||
texture_filter = 1
|
||||
script = ExtResource("1_clfqa")
|
||||
|
||||
[node name="GameOverSound" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("2_a07oi")
|
||||
autoplay = true
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
wait_time = 10.0
|
||||
one_shot = true
|
||||
@@ -61,5 +56,4 @@ layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme = ExtResource("3_km2fx")
|
||||
|
||||
[connection signal="finished" from="GameOverSound" to="." method="_on_game_over_sound_finished"]
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
|
||||
|
||||
35
Global.gd
35
Global.gd
@@ -1,5 +1,7 @@
|
||||
extends Node
|
||||
|
||||
const INT64_MAX = (1 << 63) - 1 # 9223372036854775807
|
||||
|
||||
var score : int = 0 :
|
||||
set(x):
|
||||
score = x
|
||||
@@ -18,12 +20,20 @@ var relative_mouse : bool = true :
|
||||
relative_mouse = x
|
||||
_save()
|
||||
|
||||
var volume : int :
|
||||
var music_volume : int :
|
||||
set(x):
|
||||
volume = x
|
||||
AudioServer.set_bus_volume_db(0, volume)
|
||||
music_volume = x
|
||||
AudioServer.set_bus_volume_db(1, music_volume)
|
||||
_save()
|
||||
|
||||
var effects_volume : int :
|
||||
set(x):
|
||||
effects_volume = x
|
||||
AudioServer.set_bus_volume_db(2, effects_volume)
|
||||
_save()
|
||||
|
||||
var best_times : Dictionary
|
||||
|
||||
var _loading : bool = false
|
||||
|
||||
func _ready() -> void:
|
||||
@@ -32,11 +42,15 @@ func _ready() -> void:
|
||||
var data = JSON.parse_string(FileAccess.get_file_as_string("user://data.json"))
|
||||
highscore = data.get("highscore", 0)
|
||||
relative_mouse = data.get("relative_mouse", true)
|
||||
volume = data.get("volume", AudioServer.get_bus_volume_db(0))
|
||||
music_volume = data.get("music_volume", AudioServer.get_bus_volume_db(1))
|
||||
effects_volume = data.get("effects_volume", AudioServer.get_bus_volume_db(2))
|
||||
best_times = data.get("best_times", {})
|
||||
else:
|
||||
highscore = 0
|
||||
relative_mouse = true
|
||||
volume = AudioServer.get_bus_volume_db(0)
|
||||
music_volume = AudioServer.get_bus_volume_db(1)
|
||||
effects_volume = AudioServer.get_bus_volume_db(2)
|
||||
best_times = {}
|
||||
_loading = false
|
||||
|
||||
func _save() -> void:
|
||||
@@ -45,8 +59,17 @@ func _save() -> void:
|
||||
var data : Dictionary = {
|
||||
"highscore": highscore,
|
||||
"relative_mouse": relative_mouse,
|
||||
"volume": volume
|
||||
"music_volume": music_volume,
|
||||
"effects_volume": effects_volume,
|
||||
"best_times": best_times
|
||||
}
|
||||
var f = FileAccess.open("user://data.json", FileAccess.WRITE)
|
||||
f.store_string(JSON.stringify(data))
|
||||
f.close()
|
||||
|
||||
func get_best_time(level : String) -> int:
|
||||
return best_times.get(level, INT64_MAX)
|
||||
|
||||
func set_best_time(level : String, time : int) -> void:
|
||||
best_times[level] = time
|
||||
_save()
|
||||
|
||||
25
HexOnly.gd
Normal file
25
HexOnly.gd
Normal file
@@ -0,0 +1,25 @@
|
||||
extends LineEdit
|
||||
|
||||
signal tint_changed(color : Color)
|
||||
|
||||
func _ready() -> void:
|
||||
text_changed.connect(_on_text_changed)
|
||||
text_submitted.connect(_on_text_submitted)
|
||||
|
||||
func _on_text_changed(new_text : String) -> void:
|
||||
var caret_pos = caret_column
|
||||
var t = new_text.to_upper().replace(" ", "")
|
||||
var out : String = ""
|
||||
for i in t.length():
|
||||
var c : String = t.substr(i, 1)
|
||||
match c:
|
||||
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F":
|
||||
out += c
|
||||
out = out.left(6)
|
||||
text = out
|
||||
caret_column = caret_pos
|
||||
|
||||
func _on_text_submitted(new_text : String) -> void:
|
||||
var c : Color = Color("#%s" % text)
|
||||
tint_changed.emit(c)
|
||||
release_focus()
|
||||
36
Intro.gd
36
Intro.gd
@@ -1,5 +1,14 @@
|
||||
extends Node2D
|
||||
|
||||
const credits = [
|
||||
["Design", "Majenko"],
|
||||
["Programming", "Majenko"],
|
||||
["Music", "Jeremy Blake"],
|
||||
["Sound Effects", "Majenko"]
|
||||
]
|
||||
|
||||
var credit : int = 0
|
||||
|
||||
func _ready() -> void:
|
||||
# dump_all("res://")
|
||||
|
||||
@@ -9,6 +18,33 @@ func _ready() -> void:
|
||||
_on_update_score(Global.score)
|
||||
_on_update_highscore(Global.highscore)
|
||||
$VBoxContainer/HBoxContainer/Play.grab_focus()
|
||||
Music.play_intro()
|
||||
get_tree().create_timer(5).timeout.connect(_show_credits)
|
||||
|
||||
func _show_credits() -> void:
|
||||
$HBoxContainer/Credits/CreditsRole.modulate = Color(0, 0, 0, 0)
|
||||
$HBoxContainer/Credits/CreditsPerson.modulate = Color(0, 0, 0, 0)
|
||||
$HBoxContainer/Credits/CreditsRole.text = credits[credit][0]
|
||||
$HBoxContainer/Credits/CreditsPerson.text = credits[credit][1]
|
||||
var tween = get_tree().create_tween()
|
||||
tween.tween_property($HBoxContainer/Credits/CreditsRole, "modulate", Color(1, 1, 1, 1), 1)
|
||||
tween.tween_property($HBoxContainer/Credits/CreditsPerson, "modulate", Color(1, 1, 1, 1), 1)
|
||||
tween.finished.connect(_show_credits_done)
|
||||
|
||||
func _show_credits_done() -> void:
|
||||
credit += 1
|
||||
if credit >= credits.size():
|
||||
credit = 0
|
||||
get_tree().create_timer(5).timeout.connect(_hide_credits)
|
||||
|
||||
func _hide_credits() -> void:
|
||||
var tween = get_tree().create_tween().set_parallel(true)
|
||||
tween.tween_property($HBoxContainer/Credits/CreditsRole, "modulate", Color(0, 0, 0, 0), 1)
|
||||
tween.tween_property($HBoxContainer/Credits/CreditsPerson, "modulate", Color(0, 0, 0, 0), 1)
|
||||
tween.finished.connect(_hide_credits_done)
|
||||
|
||||
func _hide_credits_done() -> void:
|
||||
get_tree().create_timer(1).timeout.connect(_show_credits)
|
||||
|
||||
func _on_button_pressed() -> void:
|
||||
get_tree().change_scene_to_file("res://Dunkanoid.tscn")
|
||||
|
||||
13
Intro.tscn
13
Intro.tscn
@@ -154,10 +154,21 @@ theme_type_variation = &"Numbers"
|
||||
text = "00000000"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="HBoxContainer"]
|
||||
[node name="Credits" type="VBoxContainer" parent="HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="CreditsRole" type="Label" parent="HBoxContainer/Credits"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("3_8d2ix")
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="CreditsPerson" type="Label" parent="HBoxContainer/Credits"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("3_8d2ix")
|
||||
theme_type_variation = &"LargeLabel"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HighScore" type="VBoxContainer" parent="HBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
extends Node2D
|
||||
|
||||
func _ready() -> void:
|
||||
Music.pause()
|
||||
|
||||
func _on_background_item_selected(index: int) -> void:
|
||||
$Background.texture = load($VBoxContainer/Background.get_item_metadata(index))
|
||||
@@ -10,6 +12,7 @@ func get_level_object() -> Dictionary:
|
||||
"left": $VBoxContainer/Left.get_selected_text(),
|
||||
"right": $VBoxContainer/Right.get_selected_text(),
|
||||
"background": $VBoxContainer/Background.get_selected_text(),
|
||||
"tint": $VBoxContainer/Tint.text,
|
||||
"data": []
|
||||
}
|
||||
for row in 18:
|
||||
@@ -35,6 +38,7 @@ func _on_save_pressed() -> void:
|
||||
$VBoxContainer/Right.select_by_name(data.right)
|
||||
|
||||
func _on_exit_pressed() -> void:
|
||||
Music.resume()
|
||||
get_tree().change_scene_to_file("res://Intro.tscn")
|
||||
|
||||
|
||||
@@ -50,11 +54,13 @@ func _on_load_panel_load_file(filename: String) -> void:
|
||||
|
||||
func load_level_from_object(data : Dictionary) -> void:
|
||||
if data != null:
|
||||
$VBoxContainer/Name.text = data.name
|
||||
$VBoxContainer/Left.select_by_name(data.left)
|
||||
$VBoxContainer/Right.select_by_name(data.right)
|
||||
$VBoxContainer/Background.select_by_name(data.background)
|
||||
$VBoxContainer/Name.text = data.get("name", "")
|
||||
$VBoxContainer/Left.select_by_name(data.get("left", "DUNKANOID"))
|
||||
$VBoxContainer/Right.select_by_name(data.get("right", "DUNKANOID"))
|
||||
$VBoxContainer/Background.select_by_name(data.get("background", "BlueSlash"))
|
||||
$Background.texture = load($VBoxContainer/Background.get_selected_filename())
|
||||
$VBoxContainer/Tint.text = data.get("tint", "FFFFFF")
|
||||
$Background.modulate = Color("#%s" % $VBoxContainer/Tint.text)
|
||||
for row in 18:
|
||||
for col in 13:
|
||||
var brick = get_node("Bricks/Row%d/Col%d" % [row, col])
|
||||
@@ -68,6 +74,7 @@ func _on_new_pressed() -> void:
|
||||
$VBoxContainer/Right.select_by_name("DUNKANOID")
|
||||
$VBoxContainer/Background.select_by_name("BlueSlash")
|
||||
$Background.texture = load($VBoxContainer/Background.get_selected_filename())
|
||||
$VBoxContainer/Tint.text = "FFFFFF"
|
||||
for row in 18:
|
||||
for col in 13:
|
||||
var brick = get_node("Bricks/Row%d/Col%d" % [row, col])
|
||||
@@ -85,3 +92,8 @@ func _on_import_pressed() -> void:
|
||||
func _on_import_panel_object_imported(data: Dictionary) -> void:
|
||||
load_level_from_object(data)
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func _on_tint_tint_changed(color: Color) -> void:
|
||||
$Background.modulate = color
|
||||
pass # Replace with function body.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://bxkneahqum6hb"]
|
||||
[gd_scene load_steps=12 format=3 uid="uid://bxkneahqum6hb"]
|
||||
|
||||
[ext_resource type="Script" path="res://LevelEditor.gd" id="1_p7hit"]
|
||||
[ext_resource type="Script" path="res://LevelEditCell.gd" id="2_ayd4g"]
|
||||
@@ -8,6 +8,7 @@
|
||||
[ext_resource type="Script" path="res://LevelSelector.gd" id="6_brm2b"]
|
||||
[ext_resource type="Script" path="res://BackgroundSelector.gd" id="7_x1vot"]
|
||||
[ext_resource type="Script" path="res://LoadPanel.gd" id="8_0o6x4"]
|
||||
[ext_resource type="Script" path="res://HexOnly.gd" id="8_72pke"]
|
||||
[ext_resource type="Script" path="res://ExportPanel.gd" id="9_nmcps"]
|
||||
[ext_resource type="Script" path="res://ImportPanel.gd" id="10_q6s0l"]
|
||||
|
||||
@@ -1949,9 +1950,8 @@ script = ExtResource("2_ayd4g")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
offset_left = 464.0
|
||||
offset_top = 16.0
|
||||
offset_right = 624.0
|
||||
offset_bottom = 344.0
|
||||
offset_bottom = 360.0
|
||||
|
||||
[node name="NameLabel" type="Label" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
@@ -2007,6 +2007,20 @@ text_overrun_behavior = 3
|
||||
clip_text = true
|
||||
script = ExtResource("7_x1vot")
|
||||
|
||||
[node name="TintLabel" type="Label" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("4_usb0o")
|
||||
text = "Tint"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Tint" type="LineEdit" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
focus_mode = 1
|
||||
theme = ExtResource("4_usb0o")
|
||||
text = "FFFFFF"
|
||||
script = ExtResource("8_72pke")
|
||||
|
||||
[node name="VSeparator" type="VSeparator" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
@@ -2066,9 +2080,8 @@ text = "EXIT"
|
||||
[node name="LoadPanel" type="PanelContainer" parent="."]
|
||||
visible = false
|
||||
offset_left = 464.0
|
||||
offset_top = 16.0
|
||||
offset_right = 624.0
|
||||
offset_bottom = 344.0
|
||||
offset_bottom = 360.0
|
||||
theme = ExtResource("4_usb0o")
|
||||
script = ExtResource("8_0o6x4")
|
||||
|
||||
@@ -2097,9 +2110,8 @@ text = "CANCEL"
|
||||
[node name="ExportPanel" type="PanelContainer" parent="."]
|
||||
visible = false
|
||||
offset_left = 464.0
|
||||
offset_top = 16.0
|
||||
offset_right = 624.0
|
||||
offset_bottom = 344.0
|
||||
offset_bottom = 360.0
|
||||
theme = ExtResource("4_usb0o")
|
||||
script = ExtResource("9_nmcps")
|
||||
|
||||
@@ -2123,9 +2135,8 @@ text = "CLOSE"
|
||||
[node name="ImportPanel" type="PanelContainer" parent="."]
|
||||
visible = false
|
||||
offset_left = 464.0
|
||||
offset_top = 16.0
|
||||
offset_right = 624.0
|
||||
offset_bottom = 344.0
|
||||
offset_bottom = 360.0
|
||||
theme = ExtResource("4_usb0o")
|
||||
script = ExtResource("10_q6s0l")
|
||||
|
||||
@@ -2156,6 +2167,7 @@ theme = ExtResource("4_usb0o")
|
||||
text = "CANCEL"
|
||||
|
||||
[connection signal="item_selected" from="VBoxContainer/Background" to="." method="_on_background_item_selected"]
|
||||
[connection signal="tint_changed" from="VBoxContainer/Tint" to="." method="_on_tint_tint_changed"]
|
||||
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Load" to="." method="_on_load_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Save" to="." method="_on_save_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/HBoxContainer3/Import" to="." method="_on_import_pressed"]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"background": "BlueSlash",
|
||||
"background": "BlueBlobs",
|
||||
"data": [
|
||||
" ",
|
||||
" ",
|
||||
@@ -22,5 +22,6 @@
|
||||
],
|
||||
"left": "RAINBOW",
|
||||
"name": "DUNKANOID",
|
||||
"right": "CUBISM"
|
||||
"right": "CUBISM",
|
||||
"tint": "FFFFFF"
|
||||
}
|
||||
27
Levels/GOOBER.json
Normal file
27
Levels/GOOBER.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"background": "Pipes",
|
||||
"data": [
|
||||
" ",
|
||||
" ",
|
||||
" ggg ggg ",
|
||||
" gWWWgWWWg ",
|
||||
" gWWWgWWWg ",
|
||||
" gWWBgBWWg ",
|
||||
" gWWBgBWWg ",
|
||||
" RRRRRRR ",
|
||||
" RRWWRWWRR ",
|
||||
" RWsWWsWWsWR ",
|
||||
"RsWsWWsWWsWsR",
|
||||
"RsWsWWsWWsWsR",
|
||||
"RWsWssWssWsWR",
|
||||
" RRWssWssWRR ",
|
||||
" RRRRRRR ",
|
||||
" Y ",
|
||||
" RYR ",
|
||||
" "
|
||||
],
|
||||
"left": "DUNKANOID",
|
||||
"name": "GOOBER",
|
||||
"right": "DUNKANOID",
|
||||
"tint": "4444CC"
|
||||
}
|
||||
27
Levels/KNOT.json
Normal file
27
Levels/KNOT.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"background": "Pipes",
|
||||
"data": [
|
||||
" ",
|
||||
" ",
|
||||
" sOs ",
|
||||
" sOs ",
|
||||
" ggggsOsggg",
|
||||
" g sOs ",
|
||||
" gBBBsOsBBB",
|
||||
" gCggsOsggg",
|
||||
" gCg sOs ",
|
||||
" gCg sOs ",
|
||||
"sssgCgssOs ",
|
||||
" gCg Os ",
|
||||
"RRRgCgRRRs ",
|
||||
"sssgCgssss ",
|
||||
" gCg ",
|
||||
" gCg ",
|
||||
" ",
|
||||
" "
|
||||
],
|
||||
"left": "DUNKANOID",
|
||||
"name": "KNOT",
|
||||
"right": "DUNKANOID",
|
||||
"tint": "4444CC"
|
||||
}
|
||||
@@ -20,7 +20,8 @@
|
||||
" ",
|
||||
" "
|
||||
],
|
||||
"left": "DUNKANOID",
|
||||
"left": "KNOT",
|
||||
"name": "SNOWCAP",
|
||||
"right": "DUNKANOID"
|
||||
"right": "GOOBER",
|
||||
"tint": "00FF00"
|
||||
}
|
||||
@@ -20,7 +20,8 @@
|
||||
" ",
|
||||
" "
|
||||
],
|
||||
"left": "DUNKANOID",
|
||||
"left": "KNOT",
|
||||
"name": "TOWER",
|
||||
"right": "DUNKANOID"
|
||||
"right": "GOOBER",
|
||||
"tint": "00FF00"
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_resource type="Theme" load_steps=15 format=3 uid="uid://cfvww0geatnnk"]
|
||||
[gd_resource type="Theme" load_steps=16 format=3 uid="uid://cfvww0geatnnk"]
|
||||
|
||||
[ext_resource type="FontFile" uid="uid://dfkm2dibf0c3b" path="res://Fonts/fonts-DSEG_v046/DSEG7-Classic-MINI/DSEG7ClassicMini-Italic.ttf" id="1_17to7"]
|
||||
[ext_resource type="FontFile" uid="uid://bx41ej4o03nbx" path="res://Fonts/arkanoid/Arka_solid.ttf" id="1_s07ae"]
|
||||
@@ -33,6 +33,7 @@ content_margin_top = 3.0
|
||||
content_margin_right = 3.0
|
||||
content_margin_bottom = 3.0
|
||||
bg_color = Color(0.168627, 0.168627, 0.168627, 1)
|
||||
draw_center = false
|
||||
corner_radius_top_left = 3
|
||||
corner_radius_top_right = 3
|
||||
corner_radius_bottom_right = 3
|
||||
@@ -87,6 +88,13 @@ corner_radius_bottom_left = 3
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_sf0ln"]
|
||||
bg_color = Color(0, 0, 0, 1)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_mruxx"]
|
||||
content_margin_top = 20.0
|
||||
content_margin_bottom = 20.0
|
||||
bg_color = Color(0, 0, 0, 0)
|
||||
shadow_color = Color(0, 0, 0, 0.439216)
|
||||
shadow_size = 25
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_m7r63"]
|
||||
|
||||
[resource]
|
||||
@@ -107,6 +115,14 @@ InternalFile/base_type = &"Button"
|
||||
InternalFile/colors/font_color = Color(0.670588, 0.458824, 0.52549, 1)
|
||||
Label/font_sizes/font_size = 20
|
||||
Label/fonts/font = ExtResource("2_7inlg")
|
||||
LargeLabel/base_type = &"Label"
|
||||
LargeLabel/colors/font_outline_color = Color(1, 0, 0, 1)
|
||||
LargeLabel/colors/font_shadow_color = Color(1, 0.388235, 0, 0.431373)
|
||||
LargeLabel/constants/outline_size = 0
|
||||
LargeLabel/constants/shadow_offset_x = 0
|
||||
LargeLabel/constants/shadow_offset_y = 0
|
||||
LargeLabel/constants/shadow_outline_size = 4
|
||||
LargeLabel/font_sizes/font_size = 20
|
||||
LineEdit/font_sizes/font_size = 20
|
||||
LineEdit/fonts/font = ExtResource("2_7inlg")
|
||||
LineEdit/styles/focus = SubResource("StyleBoxFlat_knet6")
|
||||
@@ -123,12 +139,14 @@ Numbers/constants/shadow_outline_size = 3
|
||||
Numbers/font_sizes/font_size = 18
|
||||
Numbers/fonts/font = ExtResource("1_17to7")
|
||||
PanelContainer/styles/panel = SubResource("StyleBoxFlat_sf0ln")
|
||||
RoundStart/base_type = &"PanelContainer"
|
||||
RoundStart/styles/panel = SubResource("StyleBoxFlat_mruxx")
|
||||
TextEdit/font_sizes/font_size = 9
|
||||
TextEdit/fonts/font = ExtResource("4_btndm")
|
||||
Upgrade/base_type = &"Label"
|
||||
Upgrade/colors/font_color = Color(0, 0, 0, 1)
|
||||
Upgrade/font_sizes/font_size = 16
|
||||
Upgrade/fonts/font = ExtResource("2_7inlg")
|
||||
Upgrade/font_sizes/font_size = 9
|
||||
Upgrade/fonts/font = ExtResource("4_btndm")
|
||||
UserFile/base_type = &"Button"
|
||||
UserFile/colors/font_color = Color(0.439216, 0.603922, 0.529412, 1)
|
||||
VSeparator/styles/separator = SubResource("StyleBoxEmpty_m7r63")
|
||||
|
||||
94
Music.gd
Normal file
94
Music.gd
Normal file
@@ -0,0 +1,94 @@
|
||||
extends Node
|
||||
|
||||
var MusicPlayer : AudioStreamPlayer
|
||||
|
||||
enum {
|
||||
MUSIC_INTRO,
|
||||
MUSIC_GAME
|
||||
}
|
||||
|
||||
enum {
|
||||
JINGLE_LEVEL_START,
|
||||
JINGLE_LEVEL_WON,
|
||||
JINGLE_GAME_OVER
|
||||
}
|
||||
|
||||
signal jingle_finished(type : int)
|
||||
|
||||
var music : int = MUSIC_INTRO
|
||||
var pausepos : float = 0
|
||||
|
||||
var MusicFileIntro = preload("res://Music/Through The Crystal - Jeremy Blake.mp3")
|
||||
var MusicFileGame = preload("res://Music/Powerup! - Jeremy Blake.mp3")
|
||||
|
||||
var JingleFileStart = preload("res://Sounds/Start.wav")
|
||||
var JingleFileWin = preload("res://Sounds/Win.wav")
|
||||
var JingleFileGameOver = preload("res://Sounds/GameOver.wav")
|
||||
|
||||
var jingle_playing : bool = false
|
||||
var jingle_number : int = 0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
MusicPlayer = AudioStreamPlayer.new();
|
||||
MusicPlayer.bus = "Music"
|
||||
MusicPlayer.process_mode = Node.PROCESS_MODE_ALWAYS
|
||||
add_child(MusicPlayer)
|
||||
MusicPlayer.stream = MusicFileIntro
|
||||
MusicPlayer.play()
|
||||
music = MUSIC_INTRO
|
||||
|
||||
func play_game() -> void:
|
||||
if music == MUSIC_GAME:
|
||||
return
|
||||
if jingle_playing:
|
||||
pausepos = 0
|
||||
else:
|
||||
MusicPlayer.stream = MusicFileGame
|
||||
MusicPlayer.play()
|
||||
music = MUSIC_GAME
|
||||
|
||||
func play_intro() -> void:
|
||||
if music == MUSIC_INTRO:
|
||||
return
|
||||
if jingle_playing:
|
||||
pausepos = 0
|
||||
else:
|
||||
MusicPlayer.stream = MusicFileIntro
|
||||
MusicPlayer.play()
|
||||
music = MUSIC_INTRO
|
||||
|
||||
func pause() -> void:
|
||||
pausepos = MusicPlayer.get_playback_position()
|
||||
MusicPlayer.stop()
|
||||
|
||||
func resume() -> void:
|
||||
MusicPlayer.play(pausepos)
|
||||
|
||||
func jingle(item : int) -> void:
|
||||
jingle_number = item
|
||||
MusicPlayer.finished.connect(_jingle_done)
|
||||
pause()
|
||||
match item:
|
||||
JINGLE_LEVEL_START:
|
||||
MusicPlayer.stream = JingleFileStart
|
||||
MusicPlayer.play()
|
||||
JINGLE_LEVEL_WON:
|
||||
MusicPlayer.stream = JingleFileWin
|
||||
MusicPlayer.play()
|
||||
JINGLE_GAME_OVER:
|
||||
MusicPlayer.stream = JingleFileGameOver
|
||||
MusicPlayer.play()
|
||||
jingle_playing = true
|
||||
pass
|
||||
|
||||
func _jingle_done() -> void:
|
||||
MusicPlayer.finished.disconnect(_jingle_done)
|
||||
match music:
|
||||
MUSIC_INTRO:
|
||||
MusicPlayer.stream = MusicFileIntro
|
||||
MUSIC_GAME:
|
||||
MusicPlayer.stream = MusicFileGame
|
||||
resume()
|
||||
jingle_playing = false
|
||||
jingle_finished.emit(jingle_number)
|
||||
BIN
Music/Absolutely Nothing - Jeremy Blake.mp3
Normal file
BIN
Music/Absolutely Nothing - Jeremy Blake.mp3
Normal file
Binary file not shown.
19
Music/Absolutely Nothing - Jeremy Blake.mp3.import
Normal file
19
Music/Absolutely Nothing - Jeremy Blake.mp3.import
Normal file
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
uid="uid://osk2pq7a4mat"
|
||||
path="res://.godot/imported/Absolutely Nothing - Jeremy Blake.mp3-ab36837ef722c0a363e031c45ab30a0d.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Music/Absolutely Nothing - Jeremy Blake.mp3"
|
||||
dest_files=["res://.godot/imported/Absolutely Nothing - Jeremy Blake.mp3-ab36837ef722c0a363e031c45ab30a0d.mp3str"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=true
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
BIN
Music/Powerup! - Jeremy Blake.mp3
Normal file
BIN
Music/Powerup! - Jeremy Blake.mp3
Normal file
Binary file not shown.
19
Music/Powerup! - Jeremy Blake.mp3.import
Normal file
19
Music/Powerup! - Jeremy Blake.mp3.import
Normal file
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
uid="uid://djj16e2qjk8lm"
|
||||
path="res://.godot/imported/Powerup! - Jeremy Blake.mp3-e080b90bda238d0e71a3de5cf337c6d3.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Music/Powerup! - Jeremy Blake.mp3"
|
||||
dest_files=["res://.godot/imported/Powerup! - Jeremy Blake.mp3-e080b90bda238d0e71a3de5cf337c6d3.mp3str"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=true
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
BIN
Music/Through The Crystal - Jeremy Blake.mp3
Normal file
BIN
Music/Through The Crystal - Jeremy Blake.mp3
Normal file
Binary file not shown.
19
Music/Through The Crystal - Jeremy Blake.mp3.import
Normal file
19
Music/Through The Crystal - Jeremy Blake.mp3.import
Normal file
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
uid="uid://clh8udsbx5ahm"
|
||||
path="res://.godot/imported/Through The Crystal - Jeremy Blake.mp3-1aa0395dee48bb9166b74a326aac5f33.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Music/Through The Crystal - Jeremy Blake.mp3"
|
||||
dest_files=["res://.godot/imported/Through The Crystal - Jeremy Blake.mp3-1aa0395dee48bb9166b74a326aac5f33.mp3str"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=true
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
@@ -73,8 +73,10 @@ texture = ExtResource("5_w5k41")
|
||||
|
||||
[node name="GrowSound" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("6_hpb6a")
|
||||
bus = &"Effects"
|
||||
|
||||
[node name="ShrinkSound" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("7_3krfd")
|
||||
bus = &"Effects"
|
||||
|
||||
[connection signal="timeout" from="EffectTimer" to="." method="_on_effect_timer_timeout"]
|
||||
|
||||
@@ -13,7 +13,9 @@ func _process(_delta : float) -> void:
|
||||
else:
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_CONFINED_HIDDEN)
|
||||
$VBoxContainer/HBoxContainer/Quit.release_focus()
|
||||
EventBus.unpaused.emit()
|
||||
else:
|
||||
EventBus.paused.emit()
|
||||
visible = true
|
||||
paused = true
|
||||
get_tree().paused = true
|
||||
|
||||
49
RunTimer.gd
Normal file
49
RunTimer.gd
Normal file
@@ -0,0 +1,49 @@
|
||||
extends Node
|
||||
|
||||
class_name RunTimer
|
||||
|
||||
var start_ms : int = 0
|
||||
var accumulated_pause_time : int = 0
|
||||
var pause_time : int = 0
|
||||
|
||||
var paused : bool = false
|
||||
|
||||
var elapsed_time : int :
|
||||
get:
|
||||
if paused:
|
||||
var elapsed = Time.get_ticks_msec() - pause_time
|
||||
return Time.get_ticks_msec() - start_ms - accumulated_pause_time - elapsed
|
||||
else:
|
||||
return Time.get_ticks_msec() - start_ms - accumulated_pause_time
|
||||
|
||||
func _ready() -> void:
|
||||
EventBus.paused.connect(_on_pause)
|
||||
EventBus.unpaused.connect(_on_unpause)
|
||||
|
||||
func _on_timeout() -> void:
|
||||
print(Time.get_ticks_msec())
|
||||
|
||||
func _on_pause() -> void:
|
||||
paused = true
|
||||
pause_time = Time.get_ticks_msec()
|
||||
|
||||
func pause() -> void:
|
||||
paused = true
|
||||
pause_time = Time.get_ticks_msec()
|
||||
|
||||
func unpause() -> void:
|
||||
paused = false
|
||||
var elapsed = Time.get_ticks_msec() - pause_time
|
||||
accumulated_pause_time += elapsed
|
||||
|
||||
func _on_unpause() -> void:
|
||||
paused = false
|
||||
var elapsed = Time.get_ticks_msec() - pause_time
|
||||
accumulated_pause_time += elapsed
|
||||
|
||||
func start() -> void:
|
||||
start_ms = Time.get_ticks_msec()
|
||||
accumulated_pause_time = 0
|
||||
paused = false
|
||||
|
||||
|
||||
10
Settings.gd
10
Settings.gd
@@ -3,7 +3,8 @@ extends Node2D
|
||||
func _ready() -> void:
|
||||
$VBoxContainer/HBoxContainer/LeftPanel/Relative.button_pressed = Global.relative_mouse
|
||||
$VBoxContainer/HBoxContainer/LeftPanel/Absolute.button_pressed = !Global.relative_mouse
|
||||
$VBoxContainer/HBoxContainer/RightPanel/Volume.set_value_no_signal(Global.volume)
|
||||
$VBoxContainer/HBoxContainer/RightPanel/Music.set_value_no_signal(Global.music_volume)
|
||||
$VBoxContainer/HBoxContainer/RightPanel/Effects.set_value_no_signal(Global.effects_volume)
|
||||
|
||||
func _on_relative_pressed() -> void:
|
||||
Global.relative_mouse = true
|
||||
@@ -14,6 +15,9 @@ func _on_absolute_pressed() -> void:
|
||||
func _on_exit_pressed() -> void:
|
||||
get_tree().change_scene_to_file("res://Intro.tscn")
|
||||
|
||||
func _on_volume_drag_ended(value_changed: bool) -> void:
|
||||
Global.volume = $VBoxContainer/HBoxContainer/RightPanel/Volume.value
|
||||
func _on_music_volume_drag_ended(value_changed: bool) -> void:
|
||||
Global.music_volume = $VBoxContainer/HBoxContainer/RightPanel/Music.value
|
||||
|
||||
func _on_effects_volume_drag_ended(value_changed: bool) -> void:
|
||||
Global.effects_volume = $VBoxContainer/HBoxContainer/RightPanel/Effects.value
|
||||
$Boink.play()
|
||||
|
||||
@@ -54,14 +54,27 @@ theme = ExtResource("1_lirja")
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="VolumeLabel" type="Label" parent="VBoxContainer/HBoxContainer/RightPanel"]
|
||||
[node name="MusicLabel" type="Label" parent="VBoxContainer/HBoxContainer/RightPanel"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("1_lirja")
|
||||
text = "Volume"
|
||||
text = "Music"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Volume" type="HSlider" parent="VBoxContainer/HBoxContainer/RightPanel"]
|
||||
[node name="Music" type="HSlider" parent="VBoxContainer/HBoxContainer/RightPanel"]
|
||||
layout_mode = 2
|
||||
min_value = -80.0
|
||||
max_value = 6.0
|
||||
tick_count = 10
|
||||
|
||||
[node name="EffectsLabel" type="Label" parent="VBoxContainer/HBoxContainer/RightPanel"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("1_lirja")
|
||||
text = "Effects"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Effects" type="HSlider" parent="VBoxContainer/HBoxContainer/RightPanel"]
|
||||
layout_mode = 2
|
||||
min_value = -80.0
|
||||
max_value = 6.0
|
||||
@@ -82,8 +95,10 @@ text = "Exit"
|
||||
|
||||
[node name="Boink" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("4_hgwvx")
|
||||
bus = &"Effects"
|
||||
|
||||
[connection signal="pressed" from="VBoxContainer/HBoxContainer/LeftPanel/Relative" to="." method="_on_relative_pressed"]
|
||||
[connection signal="pressed" from="VBoxContainer/HBoxContainer/LeftPanel/Absolute" to="." method="_on_absolute_pressed"]
|
||||
[connection signal="drag_ended" from="VBoxContainer/HBoxContainer/RightPanel/Volume" to="." method="_on_volume_drag_ended"]
|
||||
[connection signal="drag_ended" from="VBoxContainer/HBoxContainer/RightPanel/Music" to="." method="_on_music_volume_drag_ended"]
|
||||
[connection signal="drag_ended" from="VBoxContainer/HBoxContainer/RightPanel/Effects" to="." method="_on_effects_volume_drag_ended"]
|
||||
[connection signal="pressed" from="Exit" to="." method="_on_exit_pressed"]
|
||||
|
||||
@@ -35,9 +35,9 @@ anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -11.0
|
||||
offset_left = -12.0
|
||||
offset_top = -7.0
|
||||
offset_right = 13.0
|
||||
offset_right = 12.0
|
||||
offset_bottom = 10.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
[gd_resource type="AudioBusLayout" format=3 uid="uid://cw31i0khpovnh"]
|
||||
|
||||
[resource]
|
||||
bus/0/volume_db = -21.8264
|
||||
bus/0/volume_db = -0.128275
|
||||
bus/1/name = &"Music"
|
||||
bus/1/solo = false
|
||||
bus/1/mute = false
|
||||
bus/1/bypass_fx = false
|
||||
bus/1/volume_db = 0.0
|
||||
bus/1/send = &"Master"
|
||||
bus/2/name = &"Effects"
|
||||
bus/2/solo = false
|
||||
bus/2/mute = false
|
||||
bus/2/bypass_fx = false
|
||||
bus/2/volume_db = 0.0
|
||||
bus/2/send = &"Master"
|
||||
|
||||
@@ -24,6 +24,7 @@ config/windows_native_icon="res://icon.ico"
|
||||
|
||||
Global="*res://Global.gd"
|
||||
EventBus="*res://EventBus.gd"
|
||||
Music="*res://Music.gd"
|
||||
|
||||
[display]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user