Journal Entry 6
Date: 19.04.2022
Activity:
- Implementing project B
Notes:
Reflecting on the feedback from the last tutorial, I made the timer a bit bigger and made it red for the last 10 seconds. Besides that, I added a single block before the pushable box since everyone assumed it should be pushed on the wrong side. Also, I changed the damage of the spikes ( I oversaw that when implementing it the first time).
I am here uploading the previous build of the game as well since I did it inside Project A the last time.
Now, regarding the collapsing platforms.
I am uploading a build without it (buildUpdate-v1.0.zip) since whatever I did would not make it work.
Right now a major issue is that Ellen jumps uncontrollably on the platforms. This behavior occurred, as it seems to me, out of nowhere, since it was working fine before.
The process went as follows:
I made separate tilemap elements in the hierarchy for every one of the platforms that needed to collapse when Ellen jumps. They all had a RigidBody2D node with a dynamic option selected. Since just setting gravity and angular and linear drag did not help me achieve the behavior (the platform would fall immediately), I asked professor Černý for help. At first, per his suggestion, I tried adding the timer for the tilemap that would be triggered when Ellen touches the platform. This worked fine when the script was attached to one tilemap, however when I would add the script as a component to all of them, they would share the timer, and all platforms would collapse at once. Creating separate scripts also wasn't an option since the engine would complain that I already have a script with the same components.
After that, I tried using the coroutines as the professor suggested. This worked perfectly, and I would set gravity to be 1000 after a short time, and Ellen would be jumping nicely.
Now came the problem of resetting the platforms to their previous positions. I found in the Damageable script that Ellen has, the part of the code that gets triggered when she dies (jumps into acid for example). From here I called the restart function I added to the tilemaps "Collapse" script, which would reset the transform.position back to vector zero and reset the gravity to the original 0.2 that I set up.
Now, for some reason, the gravity gets set properly at 0.2 and then, less than a second later, it goes back to 1000. At this point, I reached one of those moments where I think the code came to life and is messing with me since I could not find the reason for this to happen. I tried adding more restrictions in order to prevent this, but nothing helped.
Somewhere while this was happening, Ellen decided to start jumping on the platforms as well, and after a while of trying to fix those 2 things, I gave up.
It is honestly a shame that I could not make this work properly, since the few times I did manage to play it with the collapsing platforms, it looked really nice and it added another "flavor" to the whole level.
Invested hours:
6 hours
Outcome:
Project B - updated
Files
Get Project B
Project B
mff-gdintro-2022-a
Status | Released |
Author | adilovicuna |
More posts
- Journal Entry 7Apr 20, 2022
Leave a comment
Log in with itch.io to leave a comment.