Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | potatobanana |
no matter how much move_speed value i put, this object still move at same speed. why, but if i remove normalize(), this object so fast
var move_speed
var move_dir = Vector2(0,0)
func _ready() -> void:
rotation_degrees = 180
pass
func _process(delta: float) -> void:
move_dir.y += move_speed * delta
global_rotation += 0.1
shoot()
move_loop()
func move_loop():
var motion = move_dir.normalized()
var collide = move_and_collide(motion)
if collide:
queue_free()
Can you try initializing move_speed to some value? Say, var move_speed = 2
instead of just var move_speed
. Also delta
in _process
is very small initially and grows over time.
o3cat | 2020-03-04 13:43
Why do you have the line pass at the top? You do know you don’t need it.
Merlin1846 | 2020-03-04 16:28