I haven’t updated this blog post in about 2 weeks, but I have been very busy. I am going to release posts that explain each area in whole, rather than in small snippets. This is so I’ll have an easier time explaining what’s happened, while I haven’t been posting.
So the first thing I am going to discuss is endless mode. I watch a some videos and read some articles to get an idea of how it would work. In short: The player doesn’t move, but everything else does. In long:
To first set this up I needed to create a new room and add in a source to run the majority of the code. The source I chose was the Ground object.
Before I could start on the ground object, I would need to add restrictions to the player Object, so I added an if (room != EndlessRoom) to a bunch of the code. I could’ve wrap the code in an if statement, however that would lock out code I do need to use.
The problem occurred is, the character wouldn’t do the run animation if I stopped them moving. So I reduced the move value to 0.1 (90% decrease) and then at the end step, the player x value would be set back to the spawn point, in this case, 96.
After I finished all the extra code needed for the Player Object, I started on the code for the Ground Object. I started off with this in create code:
The lines 3-6 are the important lines of code. The rest of the code was testing I considered using and some graphical improvements. The graphical improvements would swap cell tiles, so I could simulate some movement.
Following onward, I added in the step code:
The above code would only run if the object is set to be the source code. I originally also attached the platform to move below and then realized that was rather pointless and causing unnecessary strain on the program.
The important code is line 5-17. This code determines when an enemy should be spawned.
Continue on from this, I had a lot of problems. If I got a single variable slightly off or timed it slightly off, it would eventually crash, rather annoying to say the least.
I’m not going to go over all the code, because it would take ages to explain, but this is the create code. it is selecting a random amount of notes between 1 and 4, then it assigning a random number from 1 to 3. These numbers are used to set the note code pattern.
The enemy then gets sped up, with each successful elimination, with a maximum of 15x multiplier.
In the step code, everything is the same, except this has been added:
In the code above, it moves the guard when the right or left key is being pressed and checks where they are. If the guard moves too far to the right, they will be reset to just be outside the screen, so they are never too far away. If the guard somehow goes off the screen, they will automatically be deleted.
The other code I have wrote for this, is for the guard to be deleted once the correct pattern has been inputted, instead of falling asleep. I did this, because every so often the game would bug out input corrupted data. Meaning the note code pattern would not be solvable, even though I have given the game correct tools. I added the instance_destroy() code in a few locations, so it would always work.