Nearl implemented: bullet rotation isn't working correctly.

This commit is contained in:
Henry Faber 2026-06-16 13:56:47 +01:00
parent a9af69e7bb
commit f427bb0c8d
11 changed files with 161 additions and 9 deletions

25
test_rotation.gd Normal file
View file

@ -0,0 +1,25 @@
extends Area2D
# Simple test to verify rotation behavior
var test_angle: float = 0.0
var rotate_to_velocity: bool = true
func _process(delta):
# Move in a straight line at 100 pixels per second
var move_x = cos(deg_to_rad(test_angle)) * 100 * delta
var move_y = sin(deg_to_rad(test_angle)) * 100 * delta
position.x += move_x
position.y += move_y
# Rotate to face movement direction (this is the key fix)
if rotate_to_velocity:
var velocity = Vector2(cos(deg_to_rad(test_angle)) * 100, sin(deg_to_rad(test_angle)) * 100)
rotation = velocity.angle()
# Debug output
print("Test angle: ", test_angle, "Velocity angle:", velocity.angle(), "Rotation set to:", rotation)
func _ready():
# Set initial rotation for testing
test_angle = 0.0