Add music and bgs

This commit is contained in:
Hamcha 2019-06-03 01:35:31 +02:00
parent 10a1f37794
commit 0bcbd57b0d
Signed by: hamcha
GPG key ID: A40413D21021EAEE
22 changed files with 254 additions and 71 deletions

2
.gitignore vendored
View file

@ -1,2 +1,2 @@
.import .import
cards.zip *.zip

Binary file not shown.

View file

@ -3,16 +3,17 @@
importer="texture" importer="texture"
type="StreamTexture" type="StreamTexture"
path.s3tc="res://.import/boardbg.jpg-892d674dbade1effb8d6d07916c18ae8.s3tc.stex" path.s3tc="res://.import/boardbg.jpg-892d674dbade1effb8d6d07916c18ae8.s3tc.stex"
path.etc2="res://.import/boardbg.jpg-892d674dbade1effb8d6d07916c18ae8.etc2.stex"
path.etc="res://.import/boardbg.jpg-892d674dbade1effb8d6d07916c18ae8.etc.stex" path.etc="res://.import/boardbg.jpg-892d674dbade1effb8d6d07916c18ae8.etc.stex"
metadata={ metadata={
"imported_formats": [ "s3tc", "etc" ], "imported_formats": [ "bptc", "s3tc", "etc2", "etc" ],
"vram_texture": true "vram_texture": true
} }
[deps] [deps]
source_file="res://MLPAssets/Background/boardbg.jpg" source_file="res://MLPAssets/Background/boardbg.jpg"
dest_files=[ "res://.import/boardbg.jpg-892d674dbade1effb8d6d07916c18ae8.s3tc.stex", "res://.import/boardbg.jpg-892d674dbade1effb8d6d07916c18ae8.etc.stex" ] dest_files=[ "res://.import/boardbg.jpg-892d674dbade1effb8d6d07916c18ae8.s3tc.stex", "res://.import/boardbg.jpg-892d674dbade1effb8d6d07916c18ae8.etc2.stex", "res://.import/boardbg.jpg-892d674dbade1effb8d6d07916c18ae8.etc.stex" ]
[params] [params]

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/deckbuilderbg.png-68f7a3ffd5ce19875a051fc28635d04a.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://MLPAssets/Background/deckbuilderbg.png"
dest_files=[ "res://.import/deckbuilderbg.png-68f7a3ffd5ce19875a051fc28635d04a.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=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
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/library.webp-ce7da1a8796349bdd0765298e794a99f.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://MLPAssets/Background/library.webp"
dest_files=[ "res://.import/library.webp-ce7da1a8796349bdd0765298e794a99f.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=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
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View file

@ -3,16 +3,17 @@
importer="texture" importer="texture"
type="StreamTexture" type="StreamTexture"
path.s3tc="res://.import/unknowncard.jpg-ff165d2aeb957f4e1010ac777150182d.s3tc.stex" path.s3tc="res://.import/unknowncard.jpg-ff165d2aeb957f4e1010ac777150182d.s3tc.stex"
path.etc2="res://.import/unknowncard.jpg-ff165d2aeb957f4e1010ac777150182d.etc2.stex"
path.etc="res://.import/unknowncard.jpg-ff165d2aeb957f4e1010ac777150182d.etc.stex" path.etc="res://.import/unknowncard.jpg-ff165d2aeb957f4e1010ac777150182d.etc.stex"
metadata={ metadata={
"imported_formats": [ "s3tc", "etc" ], "imported_formats": [ "bptc", "s3tc", "etc2", "etc" ],
"vram_texture": true "vram_texture": true
} }
[deps] [deps]
source_file="res://MLPAssets/Placeholders/unknowncard.jpg" source_file="res://MLPAssets/Placeholders/unknowncard.jpg"
dest_files=[ "res://.import/unknowncard.jpg-ff165d2aeb957f4e1010ac777150182d.s3tc.stex", "res://.import/unknowncard.jpg-ff165d2aeb957f4e1010ac777150182d.etc.stex" ] dest_files=[ "res://.import/unknowncard.jpg-ff165d2aeb957f4e1010ac777150182d.s3tc.stex", "res://.import/unknowncard.jpg-ff165d2aeb957f4e1010ac777150182d.etc2.stex", "res://.import/unknowncard.jpg-ff165d2aeb957f4e1010ac777150182d.etc.stex" ]
[params] [params]

View file

@ -3,16 +3,17 @@
importer="texture" importer="texture"
type="StreamTexture" type="StreamTexture"
path.s3tc="res://.import/CardBack.png-c3e28c09100eabc5562ed76709826ce0.s3tc.stex" path.s3tc="res://.import/CardBack.png-c3e28c09100eabc5562ed76709826ce0.s3tc.stex"
path.etc2="res://.import/CardBack.png-c3e28c09100eabc5562ed76709826ce0.etc2.stex"
path.etc="res://.import/CardBack.png-c3e28c09100eabc5562ed76709826ce0.etc.stex" path.etc="res://.import/CardBack.png-c3e28c09100eabc5562ed76709826ce0.etc.stex"
metadata={ metadata={
"imported_formats": [ "s3tc", "etc" ], "imported_formats": [ "bptc", "s3tc", "etc2", "etc" ],
"vram_texture": true "vram_texture": true
} }
[deps] [deps]
source_file="res://MLPAssets/Textures/CardBack.png" source_file="res://MLPAssets/Textures/CardBack.png"
dest_files=[ "res://.import/CardBack.png-c3e28c09100eabc5562ed76709826ce0.s3tc.stex", "res://.import/CardBack.png-c3e28c09100eabc5562ed76709826ce0.etc.stex" ] dest_files=[ "res://.import/CardBack.png-c3e28c09100eabc5562ed76709826ce0.s3tc.stex", "res://.import/CardBack.png-c3e28c09100eabc5562ed76709826ce0.etc2.stex", "res://.import/CardBack.png-c3e28c09100eabc5562ed76709826ce0.etc.stex" ]
[params] [params]

View file

@ -1,14 +1,16 @@
[gd_scene load_steps=2 format=2] [gd_scene load_steps=3 format=2]
[ext_resource path="res://MLPAssets/Background/menubg.webp" type="Texture" id=1] [ext_resource path="res://Scenes/Scripts/DeckBuilder.gd" type="Script" id=1]
[ext_resource path="res://MLPAssets/Background/library.webp" type="Texture" id=2]
[node name="DeckBuilder" type="Control"] [node name="DeckBuilder" type="Control"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
script = ExtResource( 1 )
[node name="TextureRect" type="TextureRect" parent="."] [node name="TextureRect" type="TextureRect" parent="."]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
texture = ExtResource( 1 ) texture = ExtResource( 2 )
expand = true expand = true
stretch_mode = 7 stretch_mode = 7

View file

@ -1,8 +1,9 @@
[gd_scene load_steps=6 format=2] [gd_scene load_steps=7 format=2]
[ext_resource path="res://Scenes/Loading/LoadingScreen.gd" type="Script" id=1] [ext_resource path="res://Scenes/Loading/LoadingScreen.gd" type="Script" id=1]
[ext_resource path="res://Scenes/Loading/ScatterSource.gd" type="Script" id=2] [ext_resource path="res://Scenes/Loading/ScatterSource.gd" type="Script" id=2]
[ext_resource path="res://UIAssets/Effects/radialfade.png" type="Texture" id=3] [ext_resource path="res://UIAssets/Effects/radialfade.png" type="Texture" id=3]
[ext_resource path="res://UIAssets/Fonts/Catamaran.tres" type="DynamicFont" id=4]
[sub_resource type="Animation" id=1] [sub_resource type="Animation" id=1]
resource_name = "fade_in" resource_name = "fade_in"
@ -57,6 +58,30 @@ tracks/3/keys = {
"update": 1, "update": 1,
"values": [ 2, 0 ] "values": [ 2, 0 ]
} }
tracks/4/type = "value"
tracks/4/path = NodePath("Label:rect_position")
tracks/4/interp = 2
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0.8, 1.2 ),
"transitions": PoolRealArray( 0.353554, 0.840896 ),
"update": 0,
"values": [ Vector2( 363, 360 ), Vector2( 363, 328 ) ]
}
tracks/5/type = "value"
tracks/5/path = NodePath("Label:modulate")
tracks/5/interp = 2
tracks/5/loop_wrap = true
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/keys = {
"times": PoolRealArray( 0, 0.7, 1.2 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 0,
"values": [ Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 1 ) ]
}
[sub_resource type="Animation" id=2] [sub_resource type="Animation" id=2]
resource_name = "fade_out" resource_name = "fade_out"
@ -111,6 +136,18 @@ tracks/3/keys = {
"update": 1, "update": 1,
"values": [ 0, 2 ] "values": [ 0, 2 ]
} }
tracks/4/type = "value"
tracks/4/path = NodePath("Label:modulate")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/keys = {
"times": PoolRealArray( 0.4, 0.7 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 0 ) ]
}
[node name="LoadingScreen" type="Control"] [node name="LoadingScreen" type="Control"]
anchor_right = 1.0 anchor_right = 1.0
@ -135,4 +172,17 @@ expand = true
[node name="AnimationPlayer" type="AnimationPlayer" parent="."] [node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/fade_in = SubResource( 1 ) anims/fade_in = SubResource( 1 )
anims/fade_out = SubResource( 2 ) anims/fade_out = SubResource( 2 )
[node name="Label" type="Label" parent="."]
modulate = Color( 1, 1, 1, 0 )
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 363.0
margin_top = 360.0
margin_right = -338.0
margin_bottom = -260.0
custom_fonts/font = ExtResource( 4 )
text = "Loading"
align = 1
valign = 1
[connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_animation_finished"] [connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_animation_finished"]

14
Scenes/Lobby.tscn Normal file
View file

@ -0,0 +1,14 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://MLPAssets/Background/menubg.webp" type="Texture" id=1]
[node name="Lobby" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
[node name="TextureRect" type="TextureRect" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
texture = ExtResource( 1 )
expand = true
stretch_mode = 7

View file

@ -34,6 +34,8 @@ onready var zones: Dictionary = {
} }
func _ready(): func _ready():
# Load bgm
BGM.load_music("ingame1")
# Sample deck # Sample deck
var deck = [ var deck = [
"pr10","pr11","pr12","pr13","pr14","pr15","pr16","pr12","pr13","pr14", "pr10","pr11","pr12","pr13","pr14","pr15","pr16","pr12","pr13","pr14",
@ -114,17 +116,7 @@ func _process(delta: float):
holdingCard.flipped = false holdingCard.flipped = false
func _physics_process(delta): func _physics_process(delta):
# Do some raycast magic that normal Godot events cannot get (like ignoring items) raycast_zone()
var space_state := get_world().direct_space_state
var absMousePos := get_viewport().get_mouse_position()
var from: Vector3 = camera.project_ray_origin(absMousePos)
var to: Vector3 = from + camera.project_ray_normal(absMousePos) * 1000
var result := space_state.intersect_ray(from, to, [self, holdingCard], 0x7FFFFFFF, true, true)
if result:
if result.collider is Stack and result.collider.editable:
currentZone = result.collider
else:
currentZone = null
func _card_picked(card: Card): func _card_picked(card: Card):
# Call pop if applicable # Call pop if applicable
@ -166,15 +158,17 @@ func _card_moved(origin: Vector3, direction: Vector3, t: float, card: Card):
# Fix rotation if coming from hand # Fix rotation if coming from hand
card.rotation = Vector3.ZERO card.rotation = Vector3.ZERO
elif card.inZone: elif card.inZone:
card.translation = Vector3.UP * currentZone.cards.size() * currentZone.CARD_DISTANCE card.translation = Vector3.UP * zones[card.zoneName].cards.size() * zones[card.zoneName].CARD_DISTANCE
card.rotation = Vector3.ZERO card.rotation = Vector3.ZERO
else: else:
card.translation = origin + direction * t card.tween_move_to(origin + direction * t, 0.016)
# Rotate depending on what side of the board it is # Rotate depending on what side of the board it is
var baseRot = card.rotation - Vector3.UP * card.rotation.y
if card.translation.z < 0: if card.translation.z < 0:
card.rotation.y = PI card.tween_rotate(baseRot + Vector3.UP * PI, 0.04)
else: else:
card.rotation.y = 0 card.tween_rotate(baseRot, 0.04)
card.tween()
func _card_clicked(card: Card): func _card_clicked(card: Card):
if card.exhausted: if card.exhausted:
@ -293,6 +287,19 @@ func reorder_hand(playerID: int):
child.reset_transform() child.reset_transform()
child.tween() child.tween()
func raycast_zone():
# Do some raycast magic that normal Godot events cannot get (like ignoring items)
var space_state := get_world().direct_space_state
var absMousePos := get_viewport().get_mouse_position()
var from: Vector3 = camera.project_ray_origin(absMousePos)
var to: Vector3 = from + camera.project_ray_normal(absMousePos) * 1000
var result := space_state.intersect_ray(from, to, [self, holdingCard], 0x7FFFFFFF, true, true)
if result:
if result.collider is Stack and result.collider.editable:
currentZone = result.collider
else:
currentZone = null
class TransformSorter: class TransformSorter:
static func sort(a, b): static func sort(a, b):
if a.transform.origin.x < b.transform.origin.x: if a.transform.origin.x < b.transform.origin.x:

View file

@ -0,0 +1,9 @@
extends Control
signal loaded()
func _ready():
# Load bgm
BGM.load_music("deckbuilder")
emit_signal("loaded")

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=2] [gd_scene load_steps=2 format=2]
[ext_resource path="res://Scenes/SplashScreen.gd" type="Script" id=1] [ext_resource path="res://Scenes/Scripts/SplashScreen.gd" type="Script" id=1]
[node name="Control" type="Control"] [node name="Control" type="Control"]
anchor_right = 1.0 anchor_right = 1.0

17
Scenes/UI/BGMusic.gd Normal file
View file

@ -0,0 +1,17 @@
extends AudioStreamPlayer
func load_music(name: String):
# Calculate track path
var path := "res://Music/%s.ogg" % name
# Only load music if the track exists
var file := File.new()
if not file.file_exists(path):
return
var ogg_file = File.new()
ogg_file.open(path, File.READ)
var bytes = ogg_file.get_buffer(ogg_file.get_len())
var bgmstream = AudioStreamOGGVorbis.new()
bgmstream.data = bytes
stop()
stream = bgmstream
play()

7
Scenes/UI/BGMusic.tscn Normal file
View file

@ -0,0 +1,7 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://Scenes/UI/BGMusic.gd" type="Script" id=1]
[node name="BGM" type="AudioStreamPlayer"]
bus = "BGM"
script = ExtResource( 1 )

View file

@ -0,0 +1,11 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]
[ext_resource path="res://UIAssets/Fonts/Catamaran-Bold.ttf" type="DynamicFontData" id=1]
[resource]
size = 80
outline_size = 4
outline_color = Color( 0, 0, 0, 1 )
use_mipmaps = true
use_filter = true
font_data = ExtResource( 1 )

17
default_bus_layout.tres Normal file
View file

@ -0,0 +1,17 @@
[gd_resource type="AudioBusLayout" load_steps=2 format=2]
[sub_resource type="AudioEffectEQ" id=1]
resource_name = "EQ"
band_db/320_hz = -4.0
band_db/1000_hz = -10.0
band_db/3200_hz = -4.0
[resource]
bus/1/name = "BGM"
bus/1/solo = false
bus/1/mute = false
bus/1/bypass_fx = false
bus/1/volume_db = -9.4
bus/1/send = "Master"
bus/1/effect/0/effect = SubResource( 1 )
bus/1/effect/0/enabled = true

View file

@ -221,40 +221,6 @@ permissions/write_user_dictionary=false
[preset.2] [preset.2]
name="Just Cards"
platform="Windows Desktop"
runnable=true
custom_features=""
export_filter="resources"
export_files=PoolStringArray( "res://MLPAssets/Cards/ad2.webp", "res://MLPAssets/Cards/ad2b.webp", "res://MLPAssets/Cards/ad3.webp", "res://MLPAssets/Cards/ad3b.webp", "res://MLPAssets/Cards/ad4.webp", "res://MLPAssets/Cards/ad4b.webp", "res://MLPAssets/Cards/ad5.webp", "res://MLPAssets/Cards/ad5b.webp", "res://MLPAssets/Cards/ad6.webp" )
include_filter=""
exclude_filter=""
export_path=""
patch_list=PoolStringArray( )
script_export_mode=1
script_encryption_key=""
[preset.2.options]
texture_format/bptc=false
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
texture_format/no_bptc_fallbacks=true
binary_format/64_bits=true
custom_template/release=""
custom_template/debug=""
application/icon=""
application/file_version=""
application/product_version=""
application/company_name=""
application/product_name=""
application/file_description=""
application/copyright=""
application/trademarks=""
[preset.3]
name="HTML5 Full Build" name="HTML5 Full Build"
platform="HTML5" platform="HTML5"
runnable=false runnable=false
@ -267,7 +233,7 @@ patch_list=PoolStringArray( )
script_export_mode=1 script_export_mode=1
script_encryption_key="" script_encryption_key=""
[preset.3.options] [preset.2.options]
vram_texture_compression/for_desktop=true vram_texture_compression/for_desktop=true
vram_texture_compression/for_mobile=false vram_texture_compression/for_mobile=false
@ -276,7 +242,7 @@ html/head_include=""
custom_template/release="" custom_template/release=""
custom_template/debug="" custom_template/debug=""
[preset.4] [preset.3]
name="Linux/X11" name="Linux/X11"
platform="Linux/X11" platform="Linux/X11"
@ -290,7 +256,7 @@ patch_list=PoolStringArray( )
script_export_mode=1 script_export_mode=1
script_encryption_key="" script_encryption_key=""
[preset.4.options] [preset.3.options]
texture_format/bptc=false texture_format/bptc=false
texture_format/s3tc=true texture_format/s3tc=true
@ -301,25 +267,25 @@ binary_format/64_bits=true
custom_template/release="" custom_template/release=""
custom_template/debug="" custom_template/debug=""
[preset.5] [preset.4]
name="Windows Desktop" name="Windows Desktop"
platform="Windows Desktop" platform="Windows Desktop"
runnable=false runnable=true
custom_features="" custom_features=""
export_filter="all_resources" export_filter="all_resources"
include_filter="" include_filter=""
exclude_filter="" exclude_filter=""
export_path="C:/VC/mlpcardgame-out/mcg.exe" export_path="C:/VC/mlpcardgame-out/mcg-hp.exe"
patch_list=PoolStringArray( ) patch_list=PoolStringArray( )
script_export_mode=1 script_export_mode=1
script_encryption_key="" script_encryption_key=""
[preset.5.options] [preset.4.options]
texture_format/bptc=false texture_format/bptc=true
texture_format/s3tc=true texture_format/s3tc=true
texture_format/etc=false texture_format/etc=true
texture_format/etc2=false texture_format/etc2=false
texture_format/no_bptc_fallbacks=true texture_format/no_bptc_fallbacks=true
binary_format/64_bits=true binary_format/64_bits=true

View file

@ -46,6 +46,7 @@ _global_script_class_icons={
config/name="MLP CARD GAME" config/name="MLP CARD GAME"
run/main_scene="res://Scenes/SplashScreen.tscn" run/main_scene="res://Scenes/SplashScreen.tscn"
run/low_processor_mode=true
config/icon="res://icon.png" config/icon="res://icon.png"
[autoload] [autoload]
@ -53,6 +54,15 @@ config/icon="res://icon.png"
Remote="*res://Scenes/Global/Remote.tscn" Remote="*res://Scenes/Global/Remote.tscn"
Mods="*res://Scenes/Global/Mods.tscn" Mods="*res://Scenes/Global/Mods.tscn"
Loader="*res://Scenes/Global/Loader.tscn" Loader="*res://Scenes/Global/Loader.tscn"
BGM="*res://Scenes/UI/BGMusic.tscn"
[debug]
gdscript/completion/autocomplete_setters_and_getters=true
gdscript/warnings/unsafe_property_access=true
gdscript/warnings/unsafe_method_access=true
gdscript/warnings/unsafe_cast=true
gdscript/warnings/unsafe_call_argument=true
[display] [display]
@ -85,8 +95,10 @@ pan={
[rendering] [rendering]
quality/driver/driver_name="GLES2" quality/driver/driver_name="GLES2"
quality/intended_usage/framebuffer_allocation=3
vram_compression/import_bptc=true
vram_compression/import_etc=true vram_compression/import_etc=true
vram_compression/import_etc2=false quality/shadows/filter_mode=0
quality/reflections/texture_array_reflections=false quality/reflections/texture_array_reflections=false
quality/reflections/high_quality_ggx=false quality/reflections/high_quality_ggx=false
quality/depth/hdr=false quality/depth/hdr=false