Godot Version
4.2.2.
Question
lightning_2.1.tscn is my bullet.
So far it collides with my enemies, damages them, plays impact/death animations, and then deletes itself. The only thing I can’t get working is the lightning_2.1 to move. The gun follows my mouse and the bullets should be moving forward.
Here is lightning_2.1 script
extends AnimatedSprite2D
var bullet_impact_effect = preload("res://scenes/bullet_impact_effect.tscn")
var speed : int = 600
var direction : int
var damage_amount : int = 1
func _physics_process(delta):
move_local_x(direction * speed * delta)
func _on_timer_timeout():
queue_free()
func _on_hitbox_area_entered(area):
print("Bullet area entered")
bullet_impact()
func _on_hitbox_body_entered(body):
print("Bullet body entered")
bullet_impact()
func get_damage_amount() -> int:
return damage_amount
func bullet_impact():
var bullet_impact_effect_instance = bullet_impact_effect.instantiate() as Node2D
bullet_impact_effect_instance.global_position = global_position
get_parent().add_child(bullet_impact_effect_instance)
queue_free()
Let me know if you need to see any other scripts or anything!