axel
8fce988954
Added bullet template created a scene for the player character to move around in added the ability for the player character to shoot
18 lines
366 B
GDScript
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
|