Day 205

Time: 21:31


As I mentioned earlier, I wanted to display playable demos for the committed state of each day in my blog. So you can play the game I had at day 3, or day 60, or whatever.

Today, I brainstormed how I want that to work. I call it Commitopia.

I’ll continue tomorrow.

Day 205

Day 203

Time: 43:05


Found a simplification.

The code originally stored boxcar locations on two independent axes (x and y). This is too complicated and was causing bugs as I introduced acceleration and speed.

I was able to greatly simplify when I realized the train track is essentially a number line wrapped into a circle. I can store a car’s location with a single number on this line and then later “unwrap” the location based on where along the track it is.

This made for very clean code that leaves no room for bugs. The location is a single value, not some arbitrary pixel location.

Next: I want to look into making the “chug” sound match frequency with the train’s speed.

Day 203

Day 202

Time: 35:01

Added an accelerate/decelerate effect to the train. It accelerates once every 10 frames. I’ve heard about counting frames from speedrunners and fighting game players, but now I truly know what that means 🙂

I’ll sync sound and make acceleration more incremental tomorrow.

Sidenote: Had some blog presentation improvement ideas today.

  1. Visual representation of my projects on a calendar.
  2. A counter of what day I am on.
Day 202

Day 199

Time: 37:45


Did two things today:

  1. Figured out how to do a looping sound for the chugga-chugga train sound
  2. Cleaned up the movement logic as asked by the tutorial

Looping sound

Nice logic to loop sounds in Pico. Simple start/stop, although I had to do some digging to understand.

Logic improvements

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.

Day 199