Fixed attack knockback for upslash and backslash
This commit is contained in:
parent
9b05276ad6
commit
697e5ad9e4
2 changed files with 9 additions and 3 deletions
|
|
@ -19,7 +19,8 @@ var gravity = 100;
|
||||||
# Movement
|
# Movement
|
||||||
var facing = -1;
|
var facing = -1;
|
||||||
var hspeed = 150;
|
var hspeed = 150;
|
||||||
var jump_strength = 1200;
|
var ground_jump_strength = 1400;
|
||||||
|
var air_jump_strength = 1100;
|
||||||
var air_jumps_max = 1;
|
var air_jumps_max = 1;
|
||||||
var air_jumps_current = 1;
|
var air_jumps_current = 1;
|
||||||
|
|
||||||
|
|
@ -154,7 +155,10 @@ func manage_velocity(delta: float) -> void:
|
||||||
dropped = true
|
dropped = true
|
||||||
self.position += earth_aligner.global_from_local(Vector2(0,12))
|
self.position += earth_aligner.global_from_local(Vector2(0,12))
|
||||||
if(not dropped):
|
if(not dropped):
|
||||||
local_velocity.y = -jump_strength
|
if is_on_floor():
|
||||||
|
local_velocity.y = -ground_jump_strength
|
||||||
|
else:
|
||||||
|
local_velocity.y = -air_jump_strength
|
||||||
|
|
||||||
if(local_velocity.y > max_fall_speed):
|
if(local_velocity.y > max_fall_speed):
|
||||||
local_velocity.y = max_fall_speed
|
local_velocity.y = max_fall_speed
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@ func swing(dir_str) -> void:
|
||||||
anim_sprite.visible = true
|
anim_sprite.visible = true
|
||||||
await get_tree().physics_frame
|
await get_tree().physics_frame
|
||||||
await get_tree().physics_frame
|
await get_tree().physics_frame
|
||||||
|
if dir_str == "up":
|
||||||
|
apply_swing_knockback = false
|
||||||
slash_timer = slash_duration
|
slash_timer = slash_duration
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
|
|
@ -37,7 +39,7 @@ func _process(delta: float) -> void:
|
||||||
for area in get_overlapping_areas():
|
for area in get_overlapping_areas():
|
||||||
var hurt_dir = -get_parent().earth_aligner.global_from_local(Vector2(-facing, 0)).rotated(facing*rotation)
|
var hurt_dir = -get_parent().earth_aligner.global_from_local(Vector2(-facing, 0)).rotated(facing*rotation)
|
||||||
if area.hurt(damage, hurt_dir, dmg_id) and apply_swing_knockback:
|
if area.hurt(damage, hurt_dir, dmg_id) and apply_swing_knockback:
|
||||||
get_parent().reset_to_velocity = Vector2(swing_knockback * facing, 0)
|
get_parent().reset_to_velocity += Vector2(swing_knockback * facing, 0)
|
||||||
apply_swing_knockback = false
|
apply_swing_knockback = false
|
||||||
else:
|
else:
|
||||||
apply_swing_knockback = true
|
apply_swing_knockback = true
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue