Hi, it’s me, Oskar, the programmer of Great Ape. I’m back with another (hopefully) interesting devlog.
Last week I wrote about my custom made Inspector in my in-game level editor.
I have now made a simple Transform tool so you can actually, well, transform objects. I have also coded a few gameplay elements by request of other group members. These are things like modifying old code and adding logic triggers!
Transform Tool
Like mentioned above, I have since last time made a simple Transform tool which actually took quite a bit of time. Not because the tool is advanced, rather that I looked for complete solutions that I could easily implement. Those solutions did not work out because of camera trouble because of me using a RenderTexture in the level editor canvas that is using a camera further away that’s capturing the actual level.
So because of raycasts and whatnot this did not work out, which is sad since it was kinda cool. You can check out the source code for one of them on GitHub.
The tool I made was just using clicking on the object, which I already could, and checking the delta position of the mouse and then transforming the component selected. Switching between the modes is done using the standard W,E,R keyboard combo.
There’s really nothing special about the tool, it’s just there.
Gameplay elements
During the last week I also worked on some gameplay features. Great Ape is, as you probably know from other devlogs, a puzzle platformer so we needed some more “puzzle” objects.
I started by making a “TriggerObject” that uses the built-in UnityEvent. It’s easy to use since UnityEvent is already serialized in the Editor and it makes adding functions the same as with UI Buttons. The only bad thing with this is probably that UnityEvents has a fair bit more of overhead than normal C# delegates.
Now I just needed to make something to actually interact with in the game so I conjured up a lever and weight-activated button.
The lever was easy, just checking a trigger to see if an Ape entered and then allowing the user to press ‘E’ or whatever.
The button is made using three raycasts checking all objects colliding with it to see if it’s either an Ape or a physics object. The apes then have their own weight variable and the physics object uses the RigidBody2D mass.
The script also places all the objects in a list to check that we don’t add the same object twice.
I also allowed the user to make small changes like having the button only be used once and stuff like that.
The TriggerObjects don’t send any special values by themselves, only what’s specified in the Inspector when adding an action the UnityEvent. This makes you have to design all methods in a “Toggle” sense where they themselves have to invert the action by using some kind of “on-state” or the like. For example this Door script:
Vector3 goal = (open) ? orgPos : goalPos;
open = !open;
Not too much work, just a bit of a nuisance.
Otherwise the TriggerObjects work just fine.
Ending
This was the progress made in the last week which included both editor and gameplay coding. I also helped my fellow devs with programming stuff during the week to make the game as great as possible.
Sadly, this school project only has another week of time left so I probably won’t see everything I want in the level editor.
So, next week I’m planning on writing about hopefully having the level editor useable for players. I will also write a short summary about what I wanted to but couldn’t implement in the project that simply took too much time…
So on that sad note, see you next time!
0 comments