mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-22 23:48:11 +00:00
added the game
This commit is contained in:
19
Scripts/Classes/Entities/Objects/WindArea.gd
Normal file
19
Scripts/Classes/Entities/Objects/WindArea.gd
Normal file
@@ -0,0 +1,19 @@
|
||||
extends Area2D
|
||||
|
||||
@export var wind_force := 30
|
||||
|
||||
func _ready() -> void:
|
||||
await get_tree().create_timer(0.1, false).timeout
|
||||
get_parent().move_child(self, 0)
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
for i in get_overlapping_areas():
|
||||
if i.owner is Player:
|
||||
if i.owner.spring_bouncing == false and i.owner.is_on_wall() == false and i.owner.state_machine.state.name == "Normal":
|
||||
i.owner.global_position.x += wind_force * delta
|
||||
var active := get_overlapping_areas().any(func(area: Area2D) -> bool: return area.owner is Player)
|
||||
$CanvasLayer/Control/Particles.emitting = active
|
||||
if active and $SFX.is_playing() == false:
|
||||
$SFX.play()
|
||||
elif not active:
|
||||
$SFX.stop()
|
Reference in New Issue
Block a user