This is my final product. Inspired by popular rhythm games, like DDR, and Guitar Hero, the beats drop from the top along paths to the buttons corresponding to QWER respectively. Points are awarded for accuracy of the beats, while points are deducted for misses (no points are deducted for letting a beat go however). In addition to this, I wanted to add an “Undertale” theme to the game. Undertale – the massively popular indie game that came out this past October by Toby Fox. If you’ve played Undertale, you might recognize the characters in the background and some of the color references. Wait till the end of the game if you want to see the end screen! (it’s a treat!)
Me sucking at my own game: (hey it’s hard to use the gif capture software at the same time as playing)
Click to view:
Click to view:
My process started through rough sketches as seen in my proposal sketches. My first step was to create two distinct classes, Beats, and SweetSpots. This would allow me to create objects for both to get them to interact with each other and allow me to assign them unique traits (timers for example).
The second step, after creating these objects was to get them to interact with each other; I needed my beat objects to register when they were off the screen, and when they were “hit” by the sweetspot buttons – basically when they were no longer needed in the canvas. Originally I had used the filter() function similar to the space invaders code, however it was easier in the end to utilize the shift() method to remove the beginning of each beat array. In addition to this, I had originally added a “pitch” value to the Beat objects, however that method proved to be too broad of a way to correspond beats to sweetspots – I later sorted beats into four separate arrays based on their corresponding sweetspot.
I had previously also used a massive hit-detection function that ran through every beat in the beat array, checked which sweetspot button was hit, and then checked if the beat was the right pitch as well as how close it was to the sweetspot (sounds complicated right? It was.). I eventually streamlined it into a switch statement with counters for each beat array so as to only move up an index when necessary, and I also took the distance functionality and put it in it’s own separate function to further optimize the code.
Finally, I went through the song in an audio editor and manually input each beat’s corresponding time, as well as what I thought the button mapping should be (created the beatmap by hand). There is likely software out there that could analyze audio and create beatmaps, but I have not found it yet, nor did I want to make the beatmapping process overly complicated with a software that may or may not meet my needs. (Ugh, there must be at least 100 lines of code that are just the beatmap.)
All in all, I’m pretty satisfied with the finished product. There are a few kinks in there, such as the “Q” and “W” buttons losing functionality until you intentionally miss a beat with them (then they start working again mysteriously), and the fact that I have been unable to get the timing of the music matched with the beat spawning (despite the beat timings being pulled directly from the audio that is used – I think it may be a problem with how the program loads???), but it runs fairly smoothly and works as intended otherwise.