Lessons/tutorial---basic-player-traits/bullet.gd
axel 8fce988954 BULLET!
Added bullet template
created a scene for the player character to move around in
added the ability for the player character to shoot
2024-11-21 18:38:01 -08:00

18 lines
366 B
GDScript

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