diff --git a/.gitignore b/.gitignore index 1cd6420..26da10c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ .import -cards.zip \ No newline at end of file +*.zip \ No newline at end of file diff --git a/AssetSrc/deckbuilderbg.afphoto b/AssetSrc/deckbuilderbg.afphoto new file mode 100644 index 0000000..81a6f0d Binary files /dev/null and b/AssetSrc/deckbuilderbg.afphoto differ diff --git a/MLPAssets/Background/boardbg.jpg.import b/MLPAssets/Background/boardbg.jpg.import index 8c241d6..b7d1451 100644 --- a/MLPAssets/Background/boardbg.jpg.import +++ b/MLPAssets/Background/boardbg.jpg.import @@ -3,16 +3,17 @@ importer="texture" type="StreamTexture" 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" metadata={ -"imported_formats": [ "s3tc", "etc" ], +"imported_formats": [ "bptc", "s3tc", "etc2", "etc" ], "vram_texture": true } [deps] 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] diff --git a/MLPAssets/Background/deckbuilderbg.png b/MLPAssets/Background/deckbuilderbg.png new file mode 100644 index 0000000..78cbc6b Binary files /dev/null and b/MLPAssets/Background/deckbuilderbg.png differ diff --git a/MLPAssets/Background/deckbuilderbg.png.import b/MLPAssets/Background/deckbuilderbg.png.import new file mode 100644 index 0000000..989307b --- /dev/null +++ b/MLPAssets/Background/deckbuilderbg.png.import @@ -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 diff --git a/MLPAssets/Background/library.webp b/MLPAssets/Background/library.webp new file mode 100644 index 0000000..53b2232 Binary files /dev/null and b/MLPAssets/Background/library.webp differ diff --git a/MLPAssets/Background/library.webp.import b/MLPAssets/Background/library.webp.import new file mode 100644 index 0000000..52b4a3d --- /dev/null +++ b/MLPAssets/Background/library.webp.import @@ -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 diff --git a/MLPAssets/Placeholders/unknowncard.jpg.import b/MLPAssets/Placeholders/unknowncard.jpg.import index 4570711..196dd39 100644 --- a/MLPAssets/Placeholders/unknowncard.jpg.import +++ b/MLPAssets/Placeholders/unknowncard.jpg.import @@ -3,16 +3,17 @@ importer="texture" type="StreamTexture" 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" metadata={ -"imported_formats": [ "s3tc", "etc" ], +"imported_formats": [ "bptc", "s3tc", "etc2", "etc" ], "vram_texture": true } [deps] 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] diff --git a/MLPAssets/Textures/CardBack.png.import b/MLPAssets/Textures/CardBack.png.import index 77d3b6e..9c729f2 100644 --- a/MLPAssets/Textures/CardBack.png.import +++ b/MLPAssets/Textures/CardBack.png.import @@ -3,16 +3,17 @@ importer="texture" type="StreamTexture" 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" metadata={ -"imported_formats": [ "s3tc", "etc" ], +"imported_formats": [ "bptc", "s3tc", "etc2", "etc" ], "vram_texture": true } [deps] 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] diff --git a/Scenes/DeckBuilder.tscn b/Scenes/DeckBuilder.tscn index 85289cf..df9812b 100644 --- a/Scenes/DeckBuilder.tscn +++ b/Scenes/DeckBuilder.tscn @@ -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"] anchor_right = 1.0 anchor_bottom = 1.0 +script = ExtResource( 1 ) [node name="TextureRect" type="TextureRect" parent="."] anchor_right = 1.0 anchor_bottom = 1.0 -texture = ExtResource( 1 ) +texture = ExtResource( 2 ) expand = true stretch_mode = 7 diff --git a/Scenes/Loading.tscn b/Scenes/Loading.tscn index 268585e..b31f04f 100644 --- a/Scenes/Loading.tscn +++ b/Scenes/Loading.tscn @@ -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/ScatterSource.gd" type="Script" id=2] [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] resource_name = "fade_in" @@ -57,6 +58,30 @@ tracks/3/keys = { "update": 1, "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] resource_name = "fade_out" @@ -111,6 +136,18 @@ tracks/3/keys = { "update": 1, "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"] anchor_right = 1.0 @@ -135,4 +172,17 @@ expand = true [node name="AnimationPlayer" type="AnimationPlayer" parent="."] anims/fade_in = SubResource( 1 ) 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"] diff --git a/Scenes/Lobby.tscn b/Scenes/Lobby.tscn new file mode 100644 index 0000000..103ae42 --- /dev/null +++ b/Scenes/Lobby.tscn @@ -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 diff --git a/Scenes/Scripts/Board.gd b/Scenes/Scripts/Board.gd index 5fb5522..9d2f442 100644 --- a/Scenes/Scripts/Board.gd +++ b/Scenes/Scripts/Board.gd @@ -34,6 +34,8 @@ onready var zones: Dictionary = { } func _ready(): + # Load bgm + BGM.load_music("ingame1") # Sample deck var deck = [ "pr10","pr11","pr12","pr13","pr14","pr15","pr16","pr12","pr13","pr14", @@ -114,17 +116,7 @@ func _process(delta: float): holdingCard.flipped = false func _physics_process(delta): - # 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 + raycast_zone() func _card_picked(card: Card): # 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 card.rotation = Vector3.ZERO 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 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 + var baseRot = card.rotation - Vector3.UP * card.rotation.y if card.translation.z < 0: - card.rotation.y = PI + card.tween_rotate(baseRot + Vector3.UP * PI, 0.04) else: - card.rotation.y = 0 + card.tween_rotate(baseRot, 0.04) + card.tween() func _card_clicked(card: Card): if card.exhausted: @@ -293,6 +287,19 @@ func reorder_hand(playerID: int): child.reset_transform() 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: static func sort(a, b): if a.transform.origin.x < b.transform.origin.x: diff --git a/Scenes/Scripts/DeckBuilder.gd b/Scenes/Scripts/DeckBuilder.gd new file mode 100644 index 0000000..5142d26 --- /dev/null +++ b/Scenes/Scripts/DeckBuilder.gd @@ -0,0 +1,9 @@ +extends Control + +signal loaded() + +func _ready(): + # Load bgm + BGM.load_music("deckbuilder") + + emit_signal("loaded") \ No newline at end of file diff --git a/Scenes/SplashScreen.gd b/Scenes/Scripts/SplashScreen.gd similarity index 100% rename from Scenes/SplashScreen.gd rename to Scenes/Scripts/SplashScreen.gd diff --git a/Scenes/SplashScreen.tscn b/Scenes/SplashScreen.tscn index 6170625..d3fe5fe 100644 --- a/Scenes/SplashScreen.tscn +++ b/Scenes/SplashScreen.tscn @@ -1,6 +1,6 @@ [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"] anchor_right = 1.0 diff --git a/Scenes/UI/BGMusic.gd b/Scenes/UI/BGMusic.gd new file mode 100644 index 0000000..1d96880 --- /dev/null +++ b/Scenes/UI/BGMusic.gd @@ -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() \ No newline at end of file diff --git a/Scenes/UI/BGMusic.tscn b/Scenes/UI/BGMusic.tscn new file mode 100644 index 0000000..763cfa6 --- /dev/null +++ b/Scenes/UI/BGMusic.tscn @@ -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 ) diff --git a/UIAssets/Fonts/Catamaran.tres b/UIAssets/Fonts/Catamaran.tres new file mode 100644 index 0000000..2ae2ffb --- /dev/null +++ b/UIAssets/Fonts/Catamaran.tres @@ -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 ) diff --git a/default_bus_layout.tres b/default_bus_layout.tres new file mode 100644 index 0000000..00781e9 --- /dev/null +++ b/default_bus_layout.tres @@ -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 diff --git a/export_presets.cfg b/export_presets.cfg index 309f22b..9e83b27 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -221,40 +221,6 @@ permissions/write_user_dictionary=false [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" platform="HTML5" runnable=false @@ -267,7 +233,7 @@ patch_list=PoolStringArray( ) script_export_mode=1 script_encryption_key="" -[preset.3.options] +[preset.2.options] vram_texture_compression/for_desktop=true vram_texture_compression/for_mobile=false @@ -276,7 +242,7 @@ html/head_include="" custom_template/release="" custom_template/debug="" -[preset.4] +[preset.3] name="Linux/X11" platform="Linux/X11" @@ -290,7 +256,7 @@ patch_list=PoolStringArray( ) script_export_mode=1 script_encryption_key="" -[preset.4.options] +[preset.3.options] texture_format/bptc=false texture_format/s3tc=true @@ -301,25 +267,25 @@ binary_format/64_bits=true custom_template/release="" custom_template/debug="" -[preset.5] +[preset.4] name="Windows Desktop" platform="Windows Desktop" -runnable=false +runnable=true custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="C:/VC/mlpcardgame-out/mcg.exe" +export_path="C:/VC/mlpcardgame-out/mcg-hp.exe" patch_list=PoolStringArray( ) script_export_mode=1 script_encryption_key="" -[preset.5.options] +[preset.4.options] -texture_format/bptc=false +texture_format/bptc=true texture_format/s3tc=true -texture_format/etc=false +texture_format/etc=true texture_format/etc2=false texture_format/no_bptc_fallbacks=true binary_format/64_bits=true diff --git a/project.godot b/project.godot index a529ad7..0601962 100644 --- a/project.godot +++ b/project.godot @@ -46,6 +46,7 @@ _global_script_class_icons={ config/name="MLP CARD GAME" run/main_scene="res://Scenes/SplashScreen.tscn" +run/low_processor_mode=true config/icon="res://icon.png" [autoload] @@ -53,6 +54,15 @@ config/icon="res://icon.png" Remote="*res://Scenes/Global/Remote.tscn" Mods="*res://Scenes/Global/Mods.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] @@ -85,8 +95,10 @@ pan={ [rendering] quality/driver/driver_name="GLES2" +quality/intended_usage/framebuffer_allocation=3 +vram_compression/import_bptc=true vram_compression/import_etc=true -vram_compression/import_etc2=false +quality/shadows/filter_mode=0 quality/reflections/texture_array_reflections=false quality/reflections/high_quality_ggx=false quality/depth/hdr=false