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.
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.
Visual representation of my projects on a calendar.
There’s quite a bit of music capability in here. You can assemble notes in the SFX editor with control for volume and tone, and then when you are done with your pattern, you can organize them into patterns and make music.
-Make my sample games quickly playable through a link
-Continue through tutorials