This video may not look too different from the last one but there are a number of new things. Note there is a 11 segment slow centipede and a 1 segment fast centipede. So, it now supports drawing two centipedes running at different speeds. Also, you will see that the single segment centipede detects when it runs into a segment on the larger centipede and it changes direction. In general, head segments will detect when they collide or are about to collide with another segment and they will change direction. Once everything is at the bottom, things are very chaotic and they end up packed into a small space so collisions are happening all the time and there is lots of direction changing but I think it is behaving correctly. Finally, there was a problem where head segments did not always detect a mushroom and change direction last week. That is fixed.
Next, I have more centipede work to do. I want to add code to support shooting centipede segments. Also, when only one segment is left, it needs to accelerate to fast speed if it was going slowly. Once a centipede segment reaches the bottom, single segments start to randomly get inserted on the side until up to 12 are on the screen. That reminds me, I did test with 12 head segments all animating independently and it worked fine at 2.8MHz which I was worried about. The other thing I want for centipede code is to be able to describe what kind of centipedes to add at the start of the level as data. Right now, the two centipede you see in the video are “hard coded” as a 11 segment and a single segment, two different speeds, entering at those points. I want it to be a bit more generic so I can vary it easily between levels. So that is next week. More centipede work.