Did two things today:
- Figured out how to do a looping sound for the chugga-chugga train sound
- Cleaned up the movement logic as asked by the tutorial
Nice logic to loop sounds in Pico. Simple start/stop, although I had to do some digging to understand.
The basis of my improvement was understanding that the train’s direction changes only 4 times. Once at each corner.
The original code was written to check where the train should go at any given point on the track.
I updated the code to check if it is on a corner. If so, update the direction to travel. This greatly simplified the code from checking infinite cases to just checking 4.
Tomorrow: dedicate the majority of my time to automating commits and making these demos playable.