What did I do this week? The better question is what I didn't do this week. There was blood sweat and tears put into this week to prepare for the alpha and play testers. This week I managed to draft some level design ideas for the next area, create swinging platforms, have enemies not respawn with additive loading, implement tinder caches, made bats ignore platforms, implement both the player being unable to use abilities right off the bat and implement the statues that give them to the player.
Programming
Lets start off with the fun one, swinging platforms. This was a challenge for all the wrong reasons, I tried to program the movement in physics wise and could not find anything of a tutorial that could help me. So I just ended up finding out how to do circular motions and setting my own speed with transforms. Then I reduced the total possible rotation to a semi-circle and made a lot of serialized variables to adjust it when building it in the level. However it did work, I actually got a platform moving in an arc, very rigidly as I had not included acceleration and deceleration but at the end of the day the motion was the most important but there was just one new problem. The player was really slow on the platform.
I could not for the life of me figure out why this was the case. I tried everything from adjusting the player's speed to account for the motion of the platform to just even making the player faster, nothing fixed it. One time I accidentally created a whole new problem as shown below.
It wasn't until Jon looked over it and noticed I used the wrong update method, instead of fixedupdate I had used regular update. That one change fixed everything and I was very frustrated but a win is a win. So I decided to also implement the acceleration and deceleration, I just did it programmatically and created if statements that determine the state of the swing and how it's speed needs to be adjusted accordingly.
Next we have the spawners, I made it so that the spawner object holds a prefab of an enemy to spawn, the spawner keeps track of if the enemy has died and logs a transform for spawning the enemy. I also have track if it has been spawned to prevent double spawns.
This is executed within the scene details code which has a list of all the spawner objects so that it can run through them all.
The wonderful part about this code? Enemies don't respawn in the same run but respawn in a different one when they exit the gameplay scene. Here are the spawners in one of the rooms below.
Next we have the simple tinder caches, if the player collides the tinder count increases in player data and I disable the collider and sprite render. Simple enough that I won't really show the code for it. Then we have a small problem and another simple fix luckily. This didn't take me too long to figure it out how to do it. Bats we're getting stuck on our float platforms and as a result it made them less intimidating. So to fix that, I had used the platforms to detect where bats were in the rooms and disable collision for each platform.
This now makes them more intimidating a lot more of a threat than they once were.
After that was all done I now had to implement the player's challenges and rewards, particularly the gaining abilities part. So I created Booleans in the playerdata file that tracked whether an ability was gained or not. Then in the finite state machines and I included them as parts of the if-statements to block the player from using them before they had access.
This is just one example but definitely a clean and obvious one.
Now I had to undo all that work by programming a statue that gave the player the abilities.
A very simple switch case for easy setting them up in scenes in Unity.
Level Design
Above are simple sketches I had done for room ideas. Very basic but they give me ideas on how to create the next area's rooms. Given that the difficulty of the rooms is going to ramp up notably from now on.
Reflection
I got a lot done this week and I am proud of what I have accomplished, there are still some bugs with it as I was rushed to get the alpha out as soon as possible but it at least provides the basis for stuff I can work on in the future. Next week will primarily be level design with some minor programming tasks. Come back next week for more exciting updates!
Comments