My first 2D game in Godot 4.4

This commit is contained in:
2025-08-18 19:39:33 -04:00
commit 35600f72f9
83 changed files with 2512 additions and 0 deletions

21
bullet.gd Normal file
View File

@@ -0,0 +1,21 @@
extends Area2D
var travelled_distance = 0
func _physics_process(delta: float) -> void:
const SPEED = 800.0
const MAX_RANGE = 1500.0
var direction = Vector2.RIGHT.rotated(rotation)
position += (direction * SPEED) * delta
travelled_distance += SPEED * delta
if travelled_distance >= MAX_RANGE:
queue_free()
func _on_body_entered(body: Node2D) -> void:
queue_free()
if body.has_method("take_damage"):
body.take_damage()