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