Projectile Weapon

made a gun that can kill the enemy.
This commit is contained in:
sam committed 2026-10-03 15:58:09 -06:00
1 parent 2315add8ec
commit 8bfa979f06
14 files changed
+202 -13

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
extends CharacterBody2D
var SPEED = Vector2(5, 0)
const JUMP_VELOCITY = -400.0
@onready var projectile: PackedScene = preload("res://scenes/projectile.tscn")
func _ready() -> void:
$Timer.start()
func _physics_process(delta: float) -> void:
velocity += get_gravity() * delta
move_and_slide()
patrol()
func patrol():
position += SPEED
func _on_timer_timeout() -> void:
SPEED = -SPEED
$Timer.start()
func _on_area_2d_area_entered(area: Area2D) -> void:
queue_free()
func _on_area_2d_body_entered(body: Node2D) -> void:
GloblaData.death_counter -= 1