diff --git a/Assets/Sprites/Items/BlueCoin.json b/Assets/Sprites/Items/BlueCoin.json index 70997c2..5ff1913 100644 --- a/Assets/Sprites/Items/BlueCoin.json +++ b/Assets/Sprites/Items/BlueCoin.json @@ -11,7 +11,7 @@ "loop": true } }, - "properties": {"can_spawn_particles": false}, + "properties": {"can_spawn_particles": true}, "variations": { "default": {"source": "BlueCoin.png", "rect": [0, 0, 64, 16]}, "Underground": {"source": "BlueCoin.png", "rect": [0, 16, 64, 16]}, diff --git a/Assets/Sprites/Items/Coin.json b/Assets/Sprites/Items/Coin.json index 63686b1..ac470ca 100644 --- a/Assets/Sprites/Items/Coin.json +++ b/Assets/Sprites/Items/Coin.json @@ -86,7 +86,7 @@ } }, "properties": { - "can_spawn_particles": false + "can_spawn_particles": true }, "variations": { "default": {"source": "StaticCoin.png", "rect": [0, 0, 64, 16]}, diff --git a/Assets/Sprites/Items/RedCoin.json b/Assets/Sprites/Items/RedCoin.json index c96a009..7394741 100644 --- a/Assets/Sprites/Items/RedCoin.json +++ b/Assets/Sprites/Items/RedCoin.json @@ -1,5 +1,5 @@ { - "properties": {"can_spawn_particles": false}, + "properties": {"can_spawn_particles": true}, "animations": { "Collected": { "frames": [ diff --git a/Assets/Sprites/Items/SpinningCoin.json b/Assets/Sprites/Items/SpinningCoin.json index 1de430b..f98dd37 100644 --- a/Assets/Sprites/Items/SpinningCoin.json +++ b/Assets/Sprites/Items/SpinningCoin.json @@ -32,7 +32,7 @@ } }, "properties": { - "can_spawn_particles": false + "can_spawn_particles": true }, "variations": { "default": { diff --git a/Assets/Sprites/Particles/BlueCoinSparkle.png b/Assets/Sprites/Particles/BlueCoinSparkle.png index 83b0735..4d22b5a 100644 Binary files a/Assets/Sprites/Particles/BlueCoinSparkle.png and b/Assets/Sprites/Particles/BlueCoinSparkle.png differ diff --git a/Assets/Sprites/Particles/CoinSparkle.png b/Assets/Sprites/Particles/CoinSparkle.png index 4bf6d25..2043cd4 100755 Binary files a/Assets/Sprites/Particles/CoinSparkle.png and b/Assets/Sprites/Particles/CoinSparkle.png differ diff --git a/Assets/Sprites/Particles/RedCoinSparkle.png b/Assets/Sprites/Particles/RedCoinSparkle.png index 7549114..c9a236e 100644 Binary files a/Assets/Sprites/Particles/RedCoinSparkle.png and b/Assets/Sprites/Particles/RedCoinSparkle.png differ diff --git a/Assets/Sprites/Particles/SkidParticles.json b/Assets/Sprites/Particles/SkidParticles.json new file mode 100644 index 0000000..1d480d4 --- /dev/null +++ b/Assets/Sprites/Particles/SkidParticles.json @@ -0,0 +1,9 @@ +{ + "properties": { + "amount": 4, + "process_material.emission_shape": 1, + "material.particles_anim_h_frames": 5, + "lifetime": 0.25 + }, + "variations": {"default": {"source": "SkidParticles.png"}} +} diff --git a/Assets/Sprites/Particles/SkidParticles.png b/Assets/Sprites/Particles/SkidParticles.png new file mode 100644 index 0000000..421d41a Binary files /dev/null and b/Assets/Sprites/Particles/SkidParticles.png differ diff --git a/Assets/Sprites/Particles/SkidParticles.png.import b/Assets/Sprites/Particles/SkidParticles.png.import new file mode 100644 index 0000000..329e090 --- /dev/null +++ b/Assets/Sprites/Particles/SkidParticles.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bqra7e5xsdg5r" +path="res://.godot/imported/SkidParticles.png-4f132f13853c04702406f07a4c9c4263.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Sprites/Particles/SkidParticles.png" +dest_files=["res://.godot/imported/SkidParticles.png-4f132f13853c04702406f07a4c9c4263.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +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/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +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 diff --git a/Scenes/Prefabs/Entities/Player.tscn b/Scenes/Prefabs/Entities/Player.tscn index cdfc18a..4491550 100644 --- a/Scenes/Prefabs/Entities/Player.tscn +++ b/Scenes/Prefabs/Entities/Player.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=83 format=3 uid="uid://cuh62hlq8errh"] +[gd_scene load_steps=85 format=3 uid="uid://cuh62hlq8errh"] [ext_resource type="Script" uid="uid://dt4rosa5o35xr" path="res://Scripts/Classes/Entities/Player.gd" id="1_f6bau"] [ext_resource type="Script" uid="uid://uribh0f1jttq" path="res://Scripts/Classes/States/StateMachine.gd" id="2_1y62l"] @@ -23,6 +23,7 @@ [ext_resource type="Script" uid="uid://c7kmriol0gj16" path="res://Scripts/Classes/States/Player/Climb.gd" id="10_shhao"] [ext_resource type="JSON" path="res://Assets/Sprites/Players/Mario/ColourPalette.json" id="10_xy8gq"] [ext_resource type="Script" uid="uid://b10ui1x45l6ly" path="res://Scripts/Classes/States/Player/WallSlide.gd" id="11_057py"] +[ext_resource type="Texture2D" uid="uid://bqra7e5xsdg5r" path="res://Assets/Sprites/Particles/SkidParticles.png" id="11_vijl6"] [ext_resource type="Texture2D" uid="uid://dq58glgwf2l3" path="res://Assets/Sprites/UI/CheckpointIcon.png" id="13_uo1a1"] [ext_resource type="Script" uid="uid://ugfx3sb3h6rj" path="res://Scripts/Classes/States/Player/NoClip.gd" id="16_cekpg"] [ext_resource type="AudioStream" uid="uid://cbxnq518x3jqe" path="res://Assets/Audio/SFX/Skid.wav" id="18_hofol"] @@ -482,6 +483,12 @@ script = ExtResource("24_hu5lw") Overworld = ExtResource("40_o70e0") metadata/_custom_type_script = "uid://cmvlgsjmsk0v5" +[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_pm4ir"] +particles_animation = true +particles_anim_h_frames = 5 +particles_anim_v_frames = 1 +particles_anim_loop = false + [node name="Player" type="CharacterBody2D" node_paths=PackedStringArray("power_state") groups=["Players"]] process_priority = 1 process_physics_priority = 1 @@ -1120,6 +1127,18 @@ property_name = "stream" themed_resource = SubResource("Resource_xy8gq") metadata/_custom_type_script = "uid://cq6f682453q6o" +[node name="SkidParticles" type="CPUParticles2D" parent="."] +unique_name_in_owner = true +material = SubResource("CanvasItemMaterial_pm4ir") +position = Vector2(0, -2) +emitting = false +amount = 2 +texture = ExtResource("11_vijl6") +lifetime = 0.25 +gravity = Vector2(0, 0) +anim_speed_min = 1.0 +anim_speed_max = 1.0 + [connection signal="frame_changed" from="SpriteScaleJoint/Sprite" to="SpriteScaleJoint/Sprite" method="on_frame_changed"] [connection signal="sprite_frames_changed" from="SpriteScaleJoint/Sprite" to="SpriteScaleJoint/Sprite" method="on_frame_changed"] [connection signal="area_entered" from="SpriteScaleJoint/Sprite/HammerHitbox" to="." method="on_hammer_area_entered"] diff --git a/Scenes/Prefabs/Particles/BlueCoinSparkle.tscn b/Scenes/Prefabs/Particles/BlueCoinSparkle.tscn index 7e98148..9c1af59 100644 --- a/Scenes/Prefabs/Particles/BlueCoinSparkle.tscn +++ b/Scenes/Prefabs/Particles/BlueCoinSparkle.tscn @@ -11,6 +11,7 @@ particles_anim_v_frames = 1 particles_anim_loop = false [node name="CoinSparkle" type="CPUParticles2D"] +z_as_relative = false material = SubResource("CanvasItemMaterial_0guw6") emitting = false amount = 3 @@ -29,11 +30,11 @@ anim_speed_max = 2.0 [node name="ResourceSetterNew" type="Node" parent="." node_paths=PackedStringArray("node_to_affect", "property_node")] script = ExtResource("2_sgb1m") -node_to_affect = NodePath("") -property_node = NodePath("") +node_to_affect = NodePath("..") +property_node = NodePath("..") property_name = "texture" mode = 1 resource_json = ExtResource("3_l0o8p") metadata/_custom_type_script = "uid://cbal8ms2oe1ik" -[connection signal="ready" from="." to="." method="set_emitting"] +[connection signal="ready" from="." to="." method="set_emitting" binds= [true]] diff --git a/Scenes/Prefabs/Particles/CoinSparkle.tscn b/Scenes/Prefabs/Particles/CoinSparkle.tscn index 42c3fbd..b883e49 100644 --- a/Scenes/Prefabs/Particles/CoinSparkle.tscn +++ b/Scenes/Prefabs/Particles/CoinSparkle.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=6 format=3 uid="uid://b1ytbn4cu7msu"] +[gd_scene load_steps=5 format=3 uid="uid://b1ytbn4cu7msu"] [ext_resource type="Texture2D" uid="uid://dkebo0uw0dkkw" path="res://Assets/Sprites/Particles/CoinSparkle.png" id="1_4p5kk"] [ext_resource type="Script" uid="uid://cbal8ms2oe1ik" path="res://Scripts/Classes/Components/ResourceSetterNew.gd" id="2_wdqt2"] @@ -11,6 +11,7 @@ particles_anim_v_frames = 1 particles_anim_loop = false [node name="CoinSparkle" type="CPUParticles2D"] +z_as_relative = false material = SubResource("CanvasItemMaterial_0guw6") emitting = false amount = 3 diff --git a/Scenes/Prefabs/Particles/RedCoinSparkle.tscn b/Scenes/Prefabs/Particles/RedCoinSparkle.tscn index 2cad94e..4aa85ee 100644 --- a/Scenes/Prefabs/Particles/RedCoinSparkle.tscn +++ b/Scenes/Prefabs/Particles/RedCoinSparkle.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=5 format=3 uid="uid://ciif5kygsk0fu"] -[ext_resource type="Texture2D" uid="uid://dkebo0uw0dkkw" path="res://Assets/Sprites/Particles/CoinSparkle.png" id="1_1cy2p"] +[ext_resource type="Texture2D" uid="uid://c4ugewy0lof7v" path="res://Assets/Sprites/Particles/RedCoinSparkle.png" id="1_1cy2p"] [ext_resource type="Script" uid="uid://cbal8ms2oe1ik" path="res://Scripts/Classes/Components/ResourceSetterNew.gd" id="2_4yggt"] [ext_resource type="JSON" path="res://Assets/Sprites/Particles/RedCoinSparkle.json" id="3_1cy2p"] @@ -11,6 +11,7 @@ particles_anim_v_frames = 1 particles_anim_loop = false [node name="CoinSparkle" type="CPUParticles2D"] +z_as_relative = false material = SubResource("CanvasItemMaterial_0guw6") emitting = false amount = 3 @@ -29,11 +30,11 @@ anim_speed_max = 2.0 [node name="ResourceSetterNew" type="Node" parent="." node_paths=PackedStringArray("node_to_affect", "property_node")] script = ExtResource("2_4yggt") -node_to_affect = NodePath("") -property_node = NodePath("") +node_to_affect = NodePath("..") +property_node = NodePath("..") property_name = "texture" mode = 1 resource_json = ExtResource("3_1cy2p") metadata/_custom_type_script = "uid://cbal8ms2oe1ik" -[connection signal="ready" from="." to="." method="set_emitting"] +[connection signal="ready" from="." to="." method="set_emitting" binds= [true]] diff --git a/Scenes/Prefabs/UI/SettingsMenu.tscn b/Scenes/Prefabs/UI/SettingsMenu.tscn index 22a5b9c..3f91c4c 100644 --- a/Scenes/Prefabs/UI/SettingsMenu.tscn +++ b/Scenes/Prefabs/UI/SettingsMenu.tscn @@ -440,7 +440,7 @@ size_flags_vertical = 3 theme_override_constants/separation = -4 script = ExtResource("4_avtty") category_name = "SETTINGS_VISUALS" -options = [NodePath("ParallaxStyle"), NodePath("BGParticles"), NodePath("HUDStyle"), NodePath("RainbowEffect"), NodePath("TransformationEffect"), NodePath("TextShadows"), NodePath("BridgeDestructionAnimation"), NodePath("VisibleTimers"), NodePath("TransitionAnimation"), NodePath("ColourfulPipes"), NodePath("FirebarStyle")] +options = [NodePath("ParallaxStyle"), NodePath("BGParticles"), NodePath("HUDStyle"), NodePath("RainbowEffect"), NodePath("TransformationEffect"), NodePath("TextShadows"), NodePath("BridgeDestructionAnimation"), NodePath("VisibleTimers"), NodePath("TransitionAnimation"), NodePath("ColourfulPipes"), NodePath("FirebarStyle"), NodePath("ExtraParticles")] [node name="Control" type="Control" parent="PanelContainer/MarginContainer/VBoxContainer/Visuals"] custom_minimum_size = Vector2(0, 4) @@ -523,6 +523,13 @@ title = "FIREBAR STYLE" values = ["Classic", "Modern"] settings_category = "visuals" +[node name="ExtraParticles" parent="PanelContainer/MarginContainer/VBoxContainer/Visuals" groups=["Options"] instance=ExtResource("3_dl6kk")] +layout_mode = 2 +option_key = "extra_particles" +title = "EXTRA EFFECTS" +values = ["SETTING_OFF", "SETTING_ON"] +settings_category = "visuals" + [node name="VisualsSetter" type="Node" parent="PanelContainer/MarginContainer/VBoxContainer/Visuals"] script = ExtResource("9_kfq5n") @@ -1006,6 +1013,7 @@ script = ExtResource("19_k6yev") [connection signal="value_changed" from="PanelContainer/MarginContainer/VBoxContainer/Visuals/TransitionAnimation" to="PanelContainer/MarginContainer/VBoxContainer/Visuals/VisualsSetter" method="transition_style_changed"] [connection signal="value_changed" from="PanelContainer/MarginContainer/VBoxContainer/Visuals/ColourfulPipes" to="PanelContainer/MarginContainer/VBoxContainer/Visuals/VisualsSetter" method="colourful_pipes_changed"] [connection signal="value_changed" from="PanelContainer/MarginContainer/VBoxContainer/Visuals/FirebarStyle" to="PanelContainer/MarginContainer/VBoxContainer/Visuals/VisualsSetter" method="firebar_style_changed"] +[connection signal="value_changed" from="PanelContainer/MarginContainer/VBoxContainer/Visuals/ExtraParticles" to="PanelContainer/MarginContainer/VBoxContainer/Visuals/VisualsSetter" method="extra_particles"] [connection signal="button_pressed" from="PanelContainer/MarginContainer/VBoxContainer/ResourcePacks/SelectableOptionNode" to="PanelContainer/MarginContainer/VBoxContainer/ResourcePacks/ResourcePackLoader" method="open_folder"] [connection signal="button_pressed" from="PanelContainer/MarginContainer/VBoxContainer/ResourcePacks/SelectableOptionNode2" to="PanelContainer/MarginContainer/VBoxContainer/ResourcePacks/ResourcePackLoader" method="get_resource_packs"] [connection signal="button_pressed" from="PanelContainer/MarginContainer/VBoxContainer/ResourcePacks/SelectableOptionNode3" to="ResourcePackTemplateCreator" method="create_template"] diff --git a/Scripts/Classes/Entities/Items/Coin.gd b/Scripts/Classes/Entities/Items/Coin.gd index 40d79ef..b1b9a8a 100644 --- a/Scripts/Classes/Entities/Items/Coin.gd +++ b/Scripts/Classes/Entities/Items/Coin.gd @@ -19,7 +19,7 @@ func collect() -> void: DiscoLevel.combo_meter += 10 Global.score += 200 AudioManager.play_sfx("coin", global_position) - if can_spawn_particles: + if can_spawn_particles and Settings.file.visuals.extra_particles == 1: summon_particle() $Sprite.queue_free() else: diff --git a/Scripts/Classes/Entities/Items/RedCoin.gd b/Scripts/Classes/Entities/Items/RedCoin.gd index 12f4753..a5e0cb4 100644 --- a/Scripts/Classes/Entities/Items/RedCoin.gd +++ b/Scripts/Classes/Entities/Items/RedCoin.gd @@ -25,16 +25,14 @@ func collected() -> void: ChallengeModeHandler.red_coins += 1 Global.score += 200 ChallengeModeHandler.set_value(id, true) - if can_spawn_particles: + if can_spawn_particles and Settings.file.visuals.extra_particles == 1: summon_particle() - $Sprite.queue_free() - else: - queue_free() + queue_free() func summon_particle() -> void: var node = COIN_SPARKLE.instantiate() - node.finished.connect(queue_free) - add_child(node) + node.global_position = global_position + add_sibling(node) func summon_bounced_coin() -> void: var node = SPINNING_RED_COIN.instantiate() diff --git a/Scripts/Classes/Entities/Items/SpinningCoin.gd b/Scripts/Classes/Entities/Items/SpinningCoin.gd index 4c32939..26d480c 100644 --- a/Scripts/Classes/Entities/Items/SpinningCoin.gd +++ b/Scripts/Classes/Entities/Items/SpinningCoin.gd @@ -17,7 +17,7 @@ func _physics_process(delta: float) -> void: velocity.y += (15 / delta) * delta func vanish() -> void: - if can_spawn_particles: + if can_spawn_particles and Settings.file.visuals.extra_particles == 1: summon_particle() $Sprite.queue_free() else: diff --git a/Scripts/Classes/Entities/Items/SpinningRedCoin.gd b/Scripts/Classes/Entities/Items/SpinningRedCoin.gd index 3d12071..e1848ad 100644 --- a/Scripts/Classes/Entities/Items/SpinningRedCoin.gd +++ b/Scripts/Classes/Entities/Items/SpinningRedCoin.gd @@ -28,14 +28,12 @@ func _physics_process(delta: float) -> void: velocity.y += (15 / delta) * delta func vanish() -> void: - if can_spawn_particles: - $Sprite.queue_free() + if can_spawn_particles and Settings.file.visuals.extra_particles == 1: summon_particle() - else: - queue_free() + queue_free() func summon_particle() -> void: var node = COIN_SPARKLE.instantiate() node.finished.connect(queue_free) - node.global_position = global_position + node.global_position = $Sprite.global_position add_sibling(node) diff --git a/Scripts/Classes/Entities/Player.gd b/Scripts/Classes/Entities/Player.gd index 1ebdd0c..2586e88 100644 --- a/Scripts/Classes/Entities/Player.gd +++ b/Scripts/Classes/Entities/Player.gd @@ -23,6 +23,8 @@ var RUN_SPEED := 160.0 # The player's speed while running, measu var GROUND_RUN_ACCEL := 1.25 # The player's acceleration while running, measured in px/frame var RUN_SKID := 8.0 # The player's turning deceleration while running, measured in px/frame +var SKID_THRESHOLD := 100.0 # The horizontal speed required, to be able to start skidding. + var DECEL := 3.0 # The player's deceleration while no buttons are pressed, measured in px/frame var AIR_ACCEL := 3.0 # The player's acceleration while in midair, measured in px/frame var AIR_SKID := 1.5 # The player's turning deceleration while in midair, measured in px/frame @@ -182,6 +184,8 @@ static var classic_physics := false var swim_stroke := false +var skid_frames := 0 + var simulated_velocity := Vector2.ZERO func _ready() -> void: @@ -208,6 +212,7 @@ func _ready() -> void: camera.enabled = false handle_power_up_states(0) set_power_state_frame() + handle_invincible_palette() if Global.level_editor == null: recenter_camera() @@ -280,6 +285,8 @@ func _physics_process(delta: float) -> void: elif velocity.y > 15: can_bump_sfx = true handle_water_detection() + %SkidParticles.visible = Settings.file.visuals.extra_particles == 1 + %SkidParticles.emitting = ((skidding and skid_frames > 2) or crouching) and is_on_floor() and abs(velocity.x) > 25 and Settings.file.visuals.extra_particles == 1 if $SkidSFX.playing: if (is_actually_on_floor() and skidding) == false: $SkidSFX.stop() @@ -716,6 +723,7 @@ func power_up_animation(new_power_state := "") -> void: sprite.sprite_frames = old_frames await get_tree().create_timer(0.05).timeout else: + handle_invincible_palette() sprite.stop() sprite.material.set_shader_parameter("enabled", true) transforming = true diff --git a/Scripts/Classes/Singletons/SettingsManager.gd b/Scripts/Classes/Singletons/SettingsManager.gd index d49a3e9..026709f 100644 --- a/Scripts/Classes/Singletons/SettingsManager.gd +++ b/Scripts/Classes/Singletons/SettingsManager.gd @@ -68,7 +68,8 @@ var file := { "visible_timers": 0, "transition_animation": 0, "colour_pipes": 1, - "firebar_style": 0 + "firebar_style": 0, + "extra_particles": 0 }, "difficulty": { diff --git a/Scripts/Classes/States/Player/Normal.gd b/Scripts/Classes/States/Player/Normal.gd index c1d48be..029ad88 100644 --- a/Scripts/Classes/States/Player/Normal.gd +++ b/Scripts/Classes/States/Player/Normal.gd @@ -84,7 +84,7 @@ func grounded(delta: float) -> void: func handle_ground_movement(delta: float) -> void: if player.skidding: ground_skid(delta) - elif (player.input_direction != player.velocity_direction) and player.input_direction != 0 and abs(player.velocity.x) > 100 and not player.crouching: + elif (player.input_direction != player.velocity_direction) and player.input_direction != 0 and abs(player.velocity.x) > player.SKID_THRESHOLD and not player.crouching: print([player.input_direction, player.velocity_direction]) player.skidding = true elif player.input_direction != 0 and not player.crouching: @@ -112,9 +112,11 @@ func deceleration(delta: float) -> void: func ground_skid(delta: float) -> void: var target_skid := player.RUN_SKID + player.skid_frames += 1 player.velocity.x = move_toward(player.velocity.x, 1 * player.input_direction, (target_skid / delta) * delta) if abs(player.velocity.x) < 10 or player.input_direction == player.velocity_direction or player.input_direction == 0: player.skidding = false + player.skid_frames = 0 func in_air() -> void: if Global.player_action_just_pressed("jump", player.player_id): diff --git a/Scripts/Parts/VisualsSetter.gd b/Scripts/Parts/VisualsSetter.gd index e3741ae..804c7e8 100644 --- a/Scripts/Parts/VisualsSetter.gd +++ b/Scripts/Parts/VisualsSetter.gd @@ -51,6 +51,9 @@ func transition_style_changed(new_value := 0) -> void: func firebar_style_changed(new_value := 0) -> void: Settings.file.visuals.firebar_style = new_value +func extra_particles(new_value := 0) -> void: + Settings.file.visuals.extra_particles = new_value + func set_value(value_name := "", value = null) -> void: { "parallax_style": parallax_style_changed, @@ -67,5 +70,6 @@ func set_value(value_name := "", value = null) -> void: "bridge_animation": bridge_changed, "transition_animation": transform_style_changed, "colour_pipes": colourful_pipes_changed, - "firebar_style": firebar_style_changed + "firebar_style": firebar_style_changed, + "extra_particles": extra_particles }[value_name].call(value)