Audio.play() float fix!(: Music.gd cleanup! Credits! Title text Image ^.^

This commit is contained in:
Harmony Honey 2022-04-30 16:11:28 -04:00
parent 2437e2336e
commit 2b86c441a0
8 changed files with 77 additions and 25 deletions

BIN
media/image/UI/title.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -8,10 +8,10 @@ onready var menu_pause := $Menu/Pause
onready var gem_collect := $Gem/Collect
onready var gem_show := $Gem/Show
func play(arg : AudioStreamPlayer, from := 1.0, to := -1):
func play(arg : AudioStreamPlayer, from := 1.0, to := -1.0):
if !is_instance_valid(arg): return
if to == -1:
if to < 0:
arg.pitch_scale = from
else:
arg.pitch_scale = rand_range(from, to)

View file

@ -1,9 +1,6 @@
extends AudioStreamPlayer
export var ost1 : AudioStream
export var ost2: AudioStream
export var ost3 : AudioStream
export var ost4 : AudioStream
export (Array, AudioStream) var ost = []
var last_song := -1
var array = []
@ -16,21 +13,12 @@ func _on_Music_finished():
play_song()
func play_song():
if array.size() == 0:
array = [0,1,2,3]
if array.empty():
array = range(ost.size())
array.erase(last_song)
array.shuffle()
match array[0]:
0:
stream = ost1
1:
stream = ost2
2:
stream = ost3
3:
stream = ost4
stream = ost[array[0]]
last_song = array[0]
array.remove(0)
play()

View file

@ -10,9 +10,6 @@
pause_mode = 2
bus = "Music"
script = ExtResource( 1 )
ost1 = ExtResource( 2 )
ost2 = ExtResource( 3 )
ost3 = ExtResource( 4 )
ost4 = ExtResource( 5 )
ost = [ ExtResource( 2 ), ExtResource( 3 ), ExtResource( 4 ), ExtResource( 5 ) ]
[connection signal="finished" from="." to="." method="_on_Music_finished"]

View file

@ -151,4 +151,4 @@ func audio_accept():
Audio.play(Audio.menu_accept, 0.8, 1.2)
func audio_back():
Audio.play(Audio.menu_cancel, 0.8, 1.2)
Audio.play(Audio.menu_cancel, 0.6, 0.9)

11
src/menu/MenuCredits.gd Normal file
View file

@ -0,0 +1,11 @@
extends MenuBase
func _input(event):
menu_input(event)
func _physics_process(delta):
menu_process(delta)
func back():
self.is_open = false

View file

@ -3,6 +3,9 @@ extends MenuBase
export var sub_path : NodePath
onready var file_menu = get_node_or_null(sub_path)
export var credits_path : NodePath
onready var credits_menu = get_node_or_null(credits_path)
func _input(event):
menu_input(event)
@ -16,6 +19,8 @@ func accept():
sub_menu(file_menu)
"options":
sub_menu(MenuOptions)
"credits":
sub_menu(credits_menu)
"exit":
get_tree().quit()

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=22 format=2]
[gd_scene load_steps=24 format=2]
[ext_resource path="res://media/font/mini-wakuwaku.otf" type="DynamicFontData" id=1]
[ext_resource path="res://media/font/profile/PauseItem.tres" type="DynamicFont" id=2]
@ -18,6 +18,8 @@
[ext_resource path="res://src/menu/MenuFileDelete.gd" type="Script" id=16]
[ext_resource path="res://src/menu/MenuFileOpen.gd" type="Script" id=17]
[ext_resource path="res://src/menu/MenuBoot.gd" type="Script" id=18]
[ext_resource path="res://media/image/UI/title.png" type="Texture" id=19]
[ext_resource path="res://src/menu/MenuCredits.gd" type="Script" id=20]
[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0.74902, 0.376471, 0.380392, 1 )
@ -73,6 +75,7 @@ cursor_path = NodePath("Cursor")
cursor_margin = Vector2( 20, 3 )
fade_path = NodePath(".")
sub_path = NodePath("../FileMenu")
credits_path = NodePath("../Credits")
[node name="Cursor" type="Panel" parent="Canvas/MainMenu"]
anchor_right = 1.0
@ -413,6 +416,47 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Credits" type="Control" parent="Canvas"]
visible = false
margin_right = 1280.0
margin_bottom = 720.0
script = ExtResource( 20 )
__meta__ = {
"_edit_use_anchors_": false
}
is_audio_cursor = false
fade_path = NodePath(".")
[node name="Back" type="ColorRect" parent="Canvas/Credits"]
modulate = Color( 1, 1, 1, 0.8 )
anchor_right = 1.0
anchor_bottom = 1.0
color = Color( 0, 0, 0, 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label" type="Label" parent="Canvas/Credits"]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 4
size_flags_vertical = 5
custom_fonts/font = ExtResource( 2 )
text = "ROTA
by Harmony Honey
Made with Godot Engine
harmony-hunnie.itch.io"
align = 1
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Map" type="Node2D" parent="."]
__meta__ = {
"_edit_lock_": true
@ -434,12 +478,19 @@ is_cam = false
position = Vector2( 1800, 650 )
script = ExtResource( 3 )
[node name="Title" type="Sprite" parent="Map"]
modulate = Color( 0.25098, 0.25098, 0.25098, 1 )
position = Vector2( 1800, 650 )
scale = Vector2( 0.9, 0.9 )
texture = ExtResource( 19 )
[node name="Label" type="Label" parent="Map"]
visible = false
margin_left = 1500.0
margin_top = 500.0
margin_right = 2100.0
margin_bottom = 800.0
custom_colors/font_color = Color( 0.25, 0.25, 0.25, 1 )
custom_colors/font_color = Color( 0.25098, 0.25098, 0.25098, 1 )
custom_fonts/font = SubResource( 4 )
text = "ROTA"
align = 1