This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

As the title mentioned, why is this happening? My codes are as below:

Arrow code:

func _physics_process(delta):
if velocity.y < max_shoot_down_speed:
    velocity.y += Global.GRAVITY * mass * delta
var collision = move_and_collide(velocity*delta)
if collision:
rotation = velocity.angle()

func _on_hitting_target(collision):
if collision.collider.is_in_group("Stickable"):
            velocity = Vector2.ZERO
    var target_node = collision.collider
    var temp_position = global_position
    var temp_rotation = global_rotation_degrees
    self.global_position = temp_position
    self.global_rotation_degrees = temp_rotation

My enemy moving code is as below:

velocity.y += Global.GRAVITY*delta

My expectation will be after collision, my enemy still moving constantly with his velocity, but moveandslide() always return me a velocity that seems like affect by the arrow i attached to it.

Anyone please help.

in Engine by (72 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.