Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | K2119 |
Godot 4.0.2
Code:
func damaged(mob):
if $Damage.is_stopped():
$Damage.start()
@warning_ignore("unused_variable")
var direction = Vector3.ZERO
direction = ((mob.position - position) * Vector3(.1,0,-1)).normalized()
velocity.y = BOUNCE_IMPULSE
@warning_ignore("integer_division")
velocity.x = direction.x * (SPEED/2)
velocity.z = direction.z * (SPEED/2)
facing(direction * -1)
health -= mob.strength
Error part :
direction = ((mob.position - position) * Vector3(.1,0,-1)).normalized()
Edited to fix code formatting…
jgodfrey | 2023-05-10 18:24