Ideas on how I might make a gradius style option that follow player

How might I make an object that follows the players movement akin to the options in gradius? Video below for those unfamiliar with gradius. (Appears at 0:25)
https://www.youtube.com/watch?v=xKnT_XQsFyU

Buffer the player positions and add a delay by padding it with N frames of an initial position. Only cycle the next element if the player position changes and not when idle. A Ring buffer would be a good choice for this. But pop_front push_back on an array would suffice if you want to implement the concept faster.

1 Like

This is the hokey solution I came to.

var pos_buffer = [a, b, c]

func position_buffer(x):
	var max_buffer_entries = 3
	pos_buffer.push_back(x)
	while pos_buffer.size() > max_buffer_entries:
		pos_buffer.pop_front()
		return pos_buffer[2]
1 Like