Building off Konami's Medusa Head code, I got to thinking about how it relates to sinusoidal movement and how to further build off it.
When you apply horizontal motion to the Medusa Head's vertical pattern, you get what passes well enough for a sine wave. We can then say the time it takes to deviate from ystart and return to ystart is 1 period. A cycle contains 2 periods. Thus, in 2 periods the Medusa Head will have traversed all possible y-values in its cycle.




The problem is the strip spans 2 cycles, not 1. So we just need to double the wavelength once more, and voila!
We can combine the mistake that resulted in the almond-shaped eyes with the strip's code. Reversing the horizontal vector at the end of each vertical cycle will yield only the left or right half of the strip, resulting in movement somewhat like the Interceptors from Starcraft. Reversing both vectors makes it "bounce" back and forth. Reversing only the vertical vector makes it "bounce" at the middle junction, so one bounce up and one bounce down (on the next cycle).
Reversing the vectors after one horizontal cycle changes the behavior. Since a horizontal cycle is longer than a vertical cycle, the strip pattern will reverse after completion. This will result in little hiccups in the motion.
Altering how many periods must pass before reversing a vector can make it difficult for players to predict enemy movement patterns.
Additionally, let's go back to the mistake of using the same acceleration formula for both vectors. The result was a straight, diagonal line. However, if you apply cyclic vector reversal, you can actually create an X-shape by reversing one vector. Reversing both vectors takes us back to the straight line, but this time it traverses half the line each time (that will throw off gamers for sure at least the first time).
For wall-jumpers, the initial horizontal vector will determine which side the wall is when using code that reverses the horizontal vector after any cycle.
Don't be shy. Test out the different combinations
No comments:
Post a Comment