Nearl implemented: bullet rotation isn't working correctly.
This commit is contained in:
parent
a9af69e7bb
commit
f427bb0c8d
11 changed files with 161 additions and 9 deletions
25
test_rotation.gd
Normal file
25
test_rotation.gd
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue