Day 199

Time: 37:45

Commit

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s