Super-Mario-Bros-Remastered.../Scripts/Parts/DifficultySetter.gd
SkyanUltra 17a4e04766 Classic physics implemented, more params + tweaks
A big thank you to @jdaster64 and @DeadSyntaxdev for their work on the previous classic physics PRs, as without them I would not have been able to pull the values used in those PRs and recreate them at all.
- Implements CLASSIC_PARAMETERS, an alternate set of parameters to PHYSICS_PARAMETERS which is utilized based on your current Physics Behavior setting.
  - The values used in CLASSIC_PARAMETERS were lifted from #646, but they may need more tweaking.
- Implements a setting under Difficulty for Physics Behavior, with options for Modern and Classic (the default being modern)
- Many, many new physics parameters.
  - Jump Speed, Jump Gravity and Fall Gravity are all split up into Idle, Walk and Run variants based on your current speed.
    - Those thresholds have their own parameters, being "Jump Walk/Run Threshold"
  - Implemented "Classic Bounce Behavior" which replicates the original SMB's bounce mechanics when active, disabling the ability to bounce higher on enemies unless you have upwards velocity.
  - Implemented "Skid Stop Threshold", used for determining when the game considers your velocity low enough to stop you from skidding.
  - Implemented "Can Instant Stop Skid", which implements the classic SMB behavior of setting your velocity to 0 if the player's speed is low enough while skidding (determined by Skid Stop Threshold)
  - Implemented "Lock Air Accel", which implements the classic SMB behavior that prevents the player from surpassing walking speed while in the air when enabled (unless they're jumping off of a trampoline)
  - Split up "Air Accel" into "Air Walk/Run Accel", which do exactly what they sound like they do.
  - Implemented "Can Backwards Accel Run", which when disabled implements the classic SMB behavior of using your air walk acceleration at running speed while backwards accelerating.
  - Implemented "Air Backwards Accel Mult" which controls a multiplier linked to your acceleration while moving backwards, which is ported behavior from classic SMB.
  - Split up "Climb Speed" into variants for "Climb Up/Down Speed" which work exactly how you think they do. (Note: Climbing down in the original SMB is far faster, which is why this is here. I tried my best to eyeball the speed, change it however you want, though.)
  - Implemented "Swim Decel" which does exactly what it sounds like it does.
- Renamed a few parameters to be more accurate (namely "Bounce Height" to "Bounce Speed", "Power State Range" to "Power Tier Range", etc.
- New projectile parameters.
  - Rework of the "destroy on hit" param into its own "pierce count" parameter against enemies, with negative values serving as infinite pierce.
  - New hitrate parameter, to grant piercing projectiles a cooldown rate to hit the same enemy multiple times (i.e. SMB3 Hammer Suit hammers,) with negative values serving as original behavior to only hit an enemy once in its area.
  - New move speed cap parameter, which lets you set a minimum and maximum speed a projectile can travel horizontally.
  - New bounce count parameter, to set a maximum bounce count to prevent a projectile from sticking around for too long.
  - Removed folder limitation on projectile/particle file pathing. Go wild.

(Also, commented a debug print in AudioManager.)
2025-11-22 08:22:48 -05:00

50 lines
1.7 KiB
GDScript

extends Node
func damage_style_changed(new_value := 0) -> void:
Settings.file.difficulty.damage_style = new_value
func checkpoint_changed(new_value := 0) -> void:
Settings.file.difficulty.checkpoint_style = new_value
func inf_lives_changed(new_value := 0) -> void:
Settings.file.difficulty.inf_lives = new_value
func flag_lives_changed(new_value := 0) -> void:
Settings.file.difficulty.flagpole_lives = new_value
func time_limit_changed(new_value := 0) -> void:
Settings.file.difficulty.time_limit = new_value
func game_over_changed(new_value := 0) -> void:
Settings.file.difficulty.game_over_behaviour = new_value
func backscroll_changed(new_value := 0) -> void:
Settings.file.difficulty.back_scroll = new_value
func level_design_changed(new_value := 0) -> void:
Settings.file.difficulty.level_design = new_value
func extra_checkpoints_changed(new_value := 0) -> void:
Settings.file.difficulty.extra_checkpoints = new_value
func lakitu_style_changed(new_value := 0) -> void:
Settings.file.difficulty.lakitu_style = new_value
func physics_style_changed(new_value := 0):
Settings.file.difficulty.physics_style = new_value
for player in get_tree().get_nodes_in_group("Players"):
player.apply_character_physics()
func set_value(value_name := "", value := 0) -> void:
{
"damage_style": damage_style_changed,
"checkpoint_style": checkpoint_changed,
"inf_lives": inf_lives_changed,
"flagpole_lives": flag_lives_changed,
"game_over": game_over_changed,
"game_over_behaviour": game_over_changed,
"level_design": level_design_changed,
"extra_checkpoints": extra_checkpoints_changed,
"back_scroll": backscroll_changed,
"physics_style": physics_style_changed
}[value_name].call(value)