mirror of
https://github.com/Steffo99/hella-farm.git
synced 2024-11-21 15:44:23 +00:00
Add fly/drop damps and cutoffs
This commit is contained in:
parent
bacbbb7ff0
commit
c5d40c0e85
2 changed files with 14 additions and 4 deletions
|
@ -9,8 +9,10 @@ signal fallen
|
|||
|
||||
@export var acceleration = 1250.0
|
||||
@export var drag_damp = 0.4
|
||||
@export var drop_damp = 0.05
|
||||
@export var drop_epsilon = 16.0
|
||||
@export var fly_damp = 0.045
|
||||
@export var drop_damp = 0.2
|
||||
@export var fly_cutoff = 400.0
|
||||
@export var drop_cutoff = 16.0
|
||||
|
||||
var cursor: Cursor = null
|
||||
var falling: bool = false
|
||||
|
@ -40,7 +42,12 @@ func _physics_process(delta: float) -> void:
|
|||
velocity += gap * delta * acceleration
|
||||
velocity *= 1.0 - drag_damp
|
||||
else:
|
||||
velocity *= 1.0 - drop_damp
|
||||
if falling and velocity.length() < drop_epsilon:
|
||||
if velocity.length() >= fly_cutoff:
|
||||
velocity *= (1.0 - fly_damp)
|
||||
else:
|
||||
velocity *= (1.0 - drop_damp)
|
||||
|
||||
|
||||
if falling and velocity.length() < drop_cutoff:
|
||||
fall()
|
||||
move.emit(velocity * delta)
|
||||
|
|
|
@ -884,6 +884,9 @@ position = Vector2(56, -50)
|
|||
[node name="Sheep" parent="." instance=ExtResource("9_qrqqu")]
|
||||
position = Vector2(-310, 166)
|
||||
|
||||
[node name="Imp2" parent="." instance=ExtResource("10_yw228")]
|
||||
position = Vector2(408, 225)
|
||||
|
||||
[node name="Imp" parent="." instance=ExtResource("10_yw228")]
|
||||
position = Vector2(393, -137)
|
||||
|
||||
|
|
Loading…
Reference in a new issue