skid particles + extra particles setting

This commit is contained in:
JHDev2006
2025-10-01 12:33:34 +01:00
parent d0d04c64c7
commit 9e5d7bd8e6
23 changed files with 120 additions and 30 deletions

View File

@@ -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:

View File

@@ -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()

View File

@@ -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:

View File

@@ -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)

View File

@@ -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

View File

@@ -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":
{

View File

@@ -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):