How can i make a rotating cross bullet pattern?

I believe you will need rotational speed added to the bullet code. Currently your speed only applies to position.x. There are a couple ways to do this, I will example using godot’s built-in rotation property; this will also rotate the sprite. Your system was taking advantage of inherting rotation, but I believe it will be easier to reason about each bullet’s rotation.

@export var rotational_speed: float = 0

func _physics_process(delta: float) -> void:
	rotation += rotational_speed * delta

	var direction := Vector2.RIGHT.rotated(rotation)
	# applies to both axis
	position += direction * speed * delta

Now calculating how much rotational_speed would be based on the circumference of each layer. I got nerd sniped on this one, ended up making this script to spawn said bullets in a rotating cross

extends Marker2D

@export var projectile: PackedScene
@export var layer_radius: float = 20
@export var layer_count: int = 4
@export var total_layers: int = 6
@export var rotations_per_second: float = 0.5

func _ready() -> void:
	for i in range(layer_count * total_layers):
		# spawn grid coordinates
		var x := i % layer_count
		var y := floori(i / layer_count)

		# convert grid coordinates to circular/polar
		var spawn_rotation := x * TAU / layer_count
		var spawn_radius := (y + 1) * layer_radius

		var bullet := projectile.instantiate() as Bullet
		# start with rotation facing inward
		bullet.rotation = spawn_rotation + PI / 2

		# speed calculations, based on rotations per second
		bullet.rotational_speed = TAU * rotations_per_second
		var layer_circumference := TAU * spawn_radius
		bullet.speed = layer_circumference * rotations_per_second

		# debug modulate so I can track each bullet
		bullet.modulate = Color8(x * 255 / layer_count, y * 255 / total_layers, 255)

		# circular spawn position
		var xpos := cos(spawn_rotation) * spawn_radius
		var ypos := sin(spawn_rotation) * spawn_radius

		# offset by spawner's `self.position` 
		bullet.position = Vector2(xpos, ypos) + self.position
		add_sibling.call_deferred(bullet)

Here’s a screenshot of my tests, with varying layer radius, and counts.

1 Like