Lessons/tutorial---basic-player-traits/bullet.gd

18 lines
366 B
GDScript3
Raw Permalink Normal View History

extends Area2D
var speed = 1500
func _physics_process(delta):
position = calculateTrajectory(delta, transform)
func _on_Bullet_body_entered(body):
if body.is_in_group("mobs"):
body.queue_free()
queue_free()
func calculateTrajectory(delta, the_transform):
var new_position = position
new_position += the_transform.y * -speed * delta
return new_position