I fully agree, for me I'm liking Trijam as an achieveable game jam, but where I can aim to learn something new everytime!
And of course, it basically works as follows, apologies for the incoming essay but I hope it's interesting for you and/or any others:
It's a list of Vector2d points appended chronologically into an array, but the criteria for adding to the area is distance, not time. As I wanted the spaceships to move at a consistent speed and be able to still move in a consistent manner when a set of directions run out, I decided having each point in the array be equally spaced was necessary.
Once the mouse moves over 50 pixels from the origin point (either the spaceship itself, or the latest addition to the array) I minus the vector values of the current mouse position by the vector value of the origin point. The vector resulting from this calculation is then clamped, so that none of the values can exceed [-50, 50], which is done to avoid any variation from mouse speed, frame rate, etc. The clamped value is then added to the vector of the origin point and appended to the top of the array.
I'm working in Godot, so I used a Tween to set up the movement between the points itself, to keep the spaceship movement smooth and consistent. I can set the speed the spaceships will move without player input (itself set within a random range up spawning) and the Tween movement speed = distance to next array point / speed. Once the spaceship reaches the oldest point on the array, it is deleted and it focuses on the 'new' oldest point. If no points exist, it instead continues moving in the direction it is currently facing.
There are two places this currently falls down and I didn't have time in the jam to fix:
- For the very first point, when the spaceship is being used as a point of reference. Once the player clicks on a spaceship, the reference point is saved, but the ship keeps moving. As such the player can wait a few seconds and only upon moving their mouse again wil a path be drawn, creating quite a long wait time for the ship to reach the first point and a gap between the lines being drawn. This also demosntrates point number 2, in which:
- Once a path is set, the spaceship currently must reach the next point in the array before it can receive new instructions. As such, occasionally the player will create a new path for a ship to follow, but there will be a delayed response as the ship's Tween fulfilfs the final request it received from its previous path