Commit 57c8ff86 authored by Nathan Lovato's avatar Nathan Lovato

Add free software song, toggle mute button

The button fades out when the player starts to flap the gnu. It reappears every time the scene restarts
parent 6820d337
Pipeline #17507 passed with stage
in 1 minute and 15 seconds
extends AudioStreamPlayer
var mute = false setget set_mute
func set_mute(value):
mute = value
AudioServer.set_bus_mute(0, value)
[gd_scene load_steps=3 format=2]
[ext_resource path="res://assets/audio/free-softwate-song/moo-gnu-cc-freesoftwaresong.ogg" type="AudioStream" id=1]
[ext_resource path="res://Audio/MusicPlayer/MusicPlayer.gd" type="Script" id=2]
[node name="MusicPlayer" type="AudioStreamPlayer"]
stream = ExtResource( 1 )
volume_db = -3.0
pitch_scale = 1.0
autoplay = true
mix_target = 0
bus = "Master"
script = ExtResource( 2 )
# SPDX-License-Identifier: GPL-3.0-or-later
extends Node2D
extends Node
onready var pillar_spawner = $Foreground/PillarSpawner
onready var score_label = $Background/ScoreLabel
......
[gd_scene load_steps=17 format=2]
[gd_scene load_steps=18 format=2]
[ext_resource path="res://Game.gd" type="Script" id=1]
[ext_resource path="res://assets/bg.png" type="Texture" id=2]
[ext_resource path="res://assets/particle_cloud_1.png" type="Texture" id=3]
[ext_resource path="res://Score/ScoreLabel.tscn" type="PackedScene" id=4]
[ext_resource path="res://Gnu/Gnu.tscn" type="PackedScene" id=5]
[ext_resource path="res://Foreground.gd" type="Script" id=6]
[ext_resource path="res://Pillar/PillarSpawner.tscn" type="PackedScene" id=7]
[ext_resource path="res://SpriteSpawner/SpriteSpawner.gd" type="Script" id=8]
[ext_resource path="res://SpriteSpawner/PurpleMiasma.tscn" type="PackedScene" id=9]
[ext_resource path="res://SpriteSpawner/Fence.tscn" type="PackedScene" id=10]
[ext_resource path="res://UI/AudioButton.tscn" type="PackedScene" id=2]
[ext_resource path="res://assets/bg.png" type="Texture" id=3]
[ext_resource path="res://assets/particle_cloud_1.png" type="Texture" id=4]
[ext_resource path="res://Score/ScoreLabel.tscn" type="PackedScene" id=5]
[ext_resource path="res://Gnu/Gnu.tscn" type="PackedScene" id=6]
[ext_resource path="res://Foreground.gd" type="Script" id=7]
[ext_resource path="res://Pillar/PillarSpawner.tscn" type="PackedScene" id=8]
[ext_resource path="res://SpriteSpawner/SpriteSpawner.gd" type="Script" id=9]
[ext_resource path="res://SpriteSpawner/PurpleMiasma.tscn" type="PackedScene" id=10]
[ext_resource path="res://SpriteSpawner/Fence.tscn" type="PackedScene" id=11]
[sub_resource type="Gradient" id=1]
......@@ -93,11 +94,21 @@ tracks/0/keys = {
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 0 ) ]
}
[node name="Game" type="Node2D" index="0"]
[node name="Game" type="Node" index="0"]
script = ExtResource( 1 )
[node name="Background" type="CanvasLayer" parent="." index="0"]
[node name="UI" type="CanvasLayer" parent="." index="0"]
layer = 100
offset = Vector2( 0, 0 )
rotation = 0.0
scale = Vector2( 1, 1 )
transform = Transform2D( 1, 0, 0, 1, 0, 0 )
[node name="AudioButton" parent="UI" index="0" instance=ExtResource( 2 )]
[node name="Background" type="CanvasLayer" parent="." index="1"]
layer = -10
offset = Vector2( 0, 0 )
......@@ -107,7 +118,7 @@ transform = Transform2D( 1, 0, 0, 1, 0, 0 )
[node name="Sky" type="Sprite" parent="Background" index="0"]
texture = ExtResource( 2 )
texture = ExtResource( 3 )
offset = Vector2( 540, 960 )
[node name="ColorRect" type="ColorRect" parent="Background/Sky" index="0"]
......@@ -144,26 +155,27 @@ visibility_rect = Rect2( -640, -100.058, 1280, 200 )
local_coords = true
draw_order = 0
process_material = SubResource( 5 )
texture = ExtResource( 3 )
texture = ExtResource( 4 )
normal_map = null
h_frames = 1
v_frames = 1
[node name="ScoreLabel" parent="Background" index="2" instance=ExtResource( 4 )]
[node name="ScoreLabel" parent="Background" index="2" instance=ExtResource( 5 )]
margin_top = 30.0
margin_bottom = 30.0
[node name="Gnu" parent="." index="1" instance=ExtResource( 5 )]
[node name="Gnu" parent="." index="2" instance=ExtResource( 6 )]
position = Vector2( 200, 950 )
z_index = 1
[node name="Foreground" type="Node2D" parent="." index="2"]
[node name="Foreground" type="Node2D" parent="." index="3"]
script = ExtResource( 6 )
editor/display_folded = true
script = ExtResource( 7 )
[node name="PillarSpawner" parent="Foreground" index="0" instance=ExtResource( 7 )]
[node name="PillarSpawner" parent="Foreground" index="0" instance=ExtResource( 8 )]
position = Vector2( 0, 950 )
_sections_unfolded = [ "Z Index" ]
......@@ -172,9 +184,9 @@ _sections_unfolded = [ "Z Index" ]
position = Vector2( -180, 1930 )
z_index = 100
script = ExtResource( 8 )
script = ExtResource( 9 )
_sections_unfolded = [ "Z Index" ]
sprite_scene = ExtResource( 9 )
sprite_scene = ExtResource( 10 )
[node name="SpawnPosition" type="Position2D" parent="Foreground/GroundSpawner" index="0"]
......@@ -182,9 +194,9 @@ sprite_scene = ExtResource( 9 )
position = Vector2( -180, 1700 )
z_index = 100
script = ExtResource( 8 )
script = ExtResource( 9 )
_sections_unfolded = [ "Z Index" ]
sprite_scene = ExtResource( 10 )
sprite_scene = ExtResource( 11 )
[node name="SpawnPosition" type="Position2D" parent="Foreground/FenceSpawner" index="0"]
......
......@@ -5,6 +5,8 @@
[ext_resource path="res://assets/fonts/ScoreRow.tres" type="DynamicFont" id=3]
[sub_resource type="DynamicFont" id=1]
size = 300
......
extends TextureButton
onready var animation_player = $AnimationPlayer
onready var mute = MusicPlayer.mute setget set_mute
var _textures = {
off=preload('res://assets/icons/volume-mute.svg'),
on=preload('res://assets/icons/volume-up.svg'),
}
func _ready():
connect('pressed', self, '_on_pressed')
animation_player.connect('animation_finished', self, '_on_AnimationPlayer_animation_finished')
animation_player.play("fade_in")
func _unhandled_input(event):
if event.is_action_pressed('flap') and visible:
fade_out()
set_process_unhandled_input(false)
func _on_pressed():
self.mute = not mute
func _on_AnimationPlayer_animation_finished(anim_name):
match anim_name:
"fade_out":
visible = false
func set_mute(value):
mute = value
MusicPlayer.mute = value
if mute:
texture_normal = _textures.off
else:
texture_normal = _textures.on
func fade_in():
animation_player.play("fade_in")
func fade_out():
animation_player.play("fade_out")
[gd_scene load_steps=6 format=2]
[ext_resource path="res://assets/icons/volume-up.svg" type="Texture" id=1]
[ext_resource path="res://UI/AudioButton.gd" type="Script" id=2]
[sub_resource type="Animation" id=1]
resource_name = "REST"
length = 0.01
loop = false
step = 0.1
tracks/0/type = "value"
tracks/0/path = NodePath(".:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Color( 1, 1, 1, 1 ) ]
}
[sub_resource type="Animation" id=2]
resource_name = "fade_in"
length = 0.4
loop = false
step = 0.1
tracks/0/type = "value"
tracks/0/path = NodePath(".:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.4 ),
"transitions": PoolRealArray( 0.425012, 1 ),
"update": 0,
"values": [ Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 1 ) ]
}
[sub_resource type="Animation" id=3]
resource_name = "fade_out"
length = 0.4
loop = false
step = 0.1
tracks/0/type = "value"
tracks/0/path = NodePath(".:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.4 ),
"transitions": PoolRealArray( 1, 0.425012 ),
"update": 0,
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 0 ) ]
}
[node name="AudioButton" type="TextureButton"]
modulate = Color( 1, 1, 1, 0 )
anchor_left = 1.0
anchor_top = 0.0
anchor_right = 1.0
anchor_bottom = 0.0
margin_left = -230.0
margin_top = 30.0
margin_right = -30.0
margin_bottom = 183.0
rect_min_size = Vector2( 200, 100 )
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
group = null
texture_normal = ExtResource( 1 )
script = ExtResource( 2 )
_sections_unfolded = [ "Mouse", "Rect", "Textures", "Visibility" ]
[node name="AnimationPlayer" type="AnimationPlayer" parent="." index="0"]
root_node = NodePath("..")
autoplay = ""
playback_process_mode = 1
playback_default_blend_time = 0.0
playback_speed = 1.0
anims/REST = SubResource( 1 )
anims/fade_in = SubResource( 2 )
anims/fade_out = SubResource( 3 )
blend_times = [ ]
This work was collaboratively made by anonymous posters on the 4chan technology image board /g/ and licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
- https://creativecommons.org/licenses/by-sa/3.0/
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/moo-gnu-cc-freesoftwaresong.ogg-be8ab6018802255efb8ac1b54519f35d.oggstr"
[deps]
source_file="res://assets/audio/free-softwate-song/moo-gnu-cc-freesoftwaresong.ogg"
dest_files=[ "res://.import/moo-gnu-cc-freesoftwaresong.ogg-be8ab6018802255efb8ac1b54519f35d.oggstr" ]
[params]
loop=true
loop_offset=0
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="#ffffff" d="M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zM461.64 256l45.64-45.64c6.3-6.3 6.3-16.52 0-22.82l-22.82-22.82c-6.3-6.3-16.52-6.3-22.82 0L416 210.36l-45.64-45.64c-6.3-6.3-16.52-6.3-22.82 0l-22.82 22.82c-6.3 6.3-6.3 16.52 0 22.82L370.36 256l-45.63 45.63c-6.3 6.3-6.3 16.52 0 22.82l22.82 22.82c6.3 6.3 16.52 6.3 22.82 0L416 301.64l45.64 45.64c6.3 6.3 16.52 6.3 22.82 0l22.82-22.82c6.3-6.3 6.3-16.52 0-22.82L461.64 256z"/></svg>
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/volume-mute.svg-b7dab86801646507e9786e07800e9707.stex"
[deps]
source_file="res://assets/icons/volume-mute.svg"
dest_files=[ "res://.import/volume-mute.svg-b7dab86801646507e9786e07800e9707.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
stream=false
size_limit=0
detect_3d=true
svg/scale=0.3
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="#ffffff" d="M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zm233.32-51.08c-11.17-7.33-26.18-4.24-33.51 6.95-7.34 11.17-4.22 26.18 6.95 33.51 66.27 43.49 105.82 116.6 105.82 195.58 0 78.98-39.55 152.09-105.82 195.58-11.17 7.32-14.29 22.34-6.95 33.5 7.04 10.71 21.93 14.56 33.51 6.95C528.27 439.58 576 351.33 576 256S528.27 72.43 448.35 19.97zM480 256c0-63.53-32.06-121.94-85.77-156.24-11.19-7.14-26.03-3.82-33.12 7.46s-3.78 26.21 7.41 33.36C408.27 165.97 432 209.11 432 256s-23.73 90.03-63.48 115.42c-11.19 7.14-14.5 22.07-7.41 33.36 6.51 10.36 21.12 15.14 33.12 7.46C447.94 377.94 480 319.54 480 256zm-141.77-76.87c-11.58-6.33-26.19-2.16-32.61 9.45-6.39 11.61-2.16 26.2 9.45 32.61C327.98 228.28 336 241.63 336 256c0 14.38-8.02 27.72-20.92 34.81-11.61 6.41-15.84 21-9.45 32.61 6.43 11.66 21.05 15.8 32.61 9.45 28.23-15.55 45.77-45 45.77-76.88s-17.54-61.32-45.78-76.86z"/></svg>
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/volume-up.svg-821116ffa2def9a41d72799e646ef012.stex"
[deps]
source_file="res://assets/icons/volume-up.svg"
dest_files=[ "res://.import/volume-up.svg-821116ffa2def9a41d72799e646ef012.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
stream=false
size_limit=0
detect_3d=true
svg/scale=0.3
......@@ -14,6 +14,10 @@ config/name="Flossy Gnu"
run/main_scene="res://Game.tscn"
config/icon="res://icon.png"
[autoload]
MusicPlayer="*res://Audio/MusicPlayer/MusicPlayer.tscn"
[debug]
gdscript/warnings/enable=false
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment