Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
520 B
9
Indexable
Never
extends RigidBody2D

var players_touching = []
var bullet_direction = null
var start_time = 0

func _on_area_2d_body_entered(body):
	if body.is_in_group("players"):
		queue_free()
	if !self.players_touching.has(body) and body.is_in_group("players"):
		body.health -= 5
		self.players_touching.append(body)

func _on_area_2d_body_exited(body):
	self.players_touching.erase(body)

func _physics_process(delta):
	if Time.get_ticks_msec() - start_time > 2000:
		self.queue_free()
	self.translate(50 *bullet_direction*delta)
Leave a Comment