re-implement i-frames (closes #103)
This commit is contained in:
parent
5413d8aa5f
commit
b1a736745c
3 changed files with 12 additions and 2 deletions
|
@ -8,6 +8,8 @@ const ArrowProjectile = preload("res://objects/player/arrow_projectile.tscn")
|
|||
const DeathSplatter = preload("res://objects/player/player_death_particles.tscn")
|
||||
|
||||
# EXPORTS #
|
||||
## whether to be temporarily invulnerable after respawning
|
||||
export var use_iframes: bool = false
|
||||
## horizontal movement speed
|
||||
export var walk_speed: float = 50.0
|
||||
## frames until walk speed peak (at 60fps reference)
|
||||
|
@ -26,8 +28,7 @@ export var jump_force: float = 150.0
|
|||
export var jump_release_force: float = 0.25
|
||||
## impulse added when double jumping
|
||||
export var double_jump_force: float = 122.0
|
||||
## blinking time
|
||||
export var blinking_time: float = 10.0
|
||||
|
||||
|
||||
# velocity
|
||||
var velocity: Vector2 = Vector2.ZERO
|
||||
|
@ -63,6 +64,7 @@ func _ready() -> void:
|
|||
# set up state chart
|
||||
state_chart.initialize()
|
||||
state_chart.set_guard_property("can_respawn", true)
|
||||
state_chart.set_guard_property("use_iframes", use_iframes)
|
||||
# state chart debug
|
||||
$StateDebugLayer/StateChartDebug.target = state_chart
|
||||
|
||||
|
|
|
@ -1128,9 +1128,16 @@ script = ExtResource( 11 )
|
|||
[node name="Respawn" type="Node" parent="StateChart/Root/Health"]
|
||||
script = ExtResource( 11 )
|
||||
|
||||
[node name="If Iframes" type="Node" parent="StateChart/Root/Health/Respawn"]
|
||||
script = ExtResource( 10 )
|
||||
to = NodePath("../../Vulnerable")
|
||||
delay = 0.5
|
||||
guard_expression = "use_iframes"
|
||||
|
||||
[node name="On Timeout" type="Node" parent="StateChart/Root/Health/Respawn"]
|
||||
script = ExtResource( 10 )
|
||||
to = NodePath("../../Vulnerable")
|
||||
guard_expression = "!use_iframes"
|
||||
|
||||
[node name="Dead" type="Node" parent="StateChart/Root/Health"]
|
||||
script = ExtResource( 11 )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue