0 votes
extends RigidBody2D    

func shoot_at_mouse_5_up(start_pos):
    self.global_position = start_pos
    var direction = (player.position - start_pos).normalized()
    self.linear_velocity = direction * speed

How could I solve it? Is it possible to solve with an integer value? If it is, how could I convert global.position rounding a integer value?

in Engine by (170 points)

1 Answer

0 votes

It sounds like start_pos is a float such as 4.5, what you want to pass in is a Vector2(x, y).

by (52 points)
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 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 webmaster@godotengine.org with your username.