Making a fighting game, and i’ve made a dash but the dash goes through the other player and through walls, how would I fix this?
This is in func _input(event)
# Dash
if find_motion_input_from_array(input_history, (MOTION_MAP["dash"] if facing_right else MOTION_MAP["bdash"])) and actionable:
input_history.clear()
match airborne:
true: # Air Dash
print("Airdash")
false: # Grounded Dash
var newPosition = position + Vector3(2*(1 if facing_right else -1),0,0)
animActionable = false
$AnimatedSprite3D.play("dash")
await get_tree().create_tween().tween_property(self, "position", newPosition, DASH_SPEED).finished
animActionable = true
When using velocity, I had the problem of it looking like the character was just teleporting forward, rather than dashing forward and wouldnt play the animation. It would old randomly teleport you across the screen.
this was the old code I had using velocity, do you know how I could fix this?
false: # Grounded Dash
var newPosition = position + Vector3(2*(1 if facing_right else -1),0,0)
animActionable = false
$AnimatedSprite3D.play("dash")
var newVelocity = get_velocity() + Vector3(50*(1 if facing_right else -1),0,0)
set_velocity(newVelocity)
move_and_slide()
animActionable = true