Week 2 - Basic Level Blocking & Interactions
Week 2 - Basic Level Blocking & Interactions
This week I started work on laying out the level, as I'll only be making a single level I figured I should spend some time making it interesting with some graphics and interactable stuff.
Basic Layout
So, first off, I set out laying out the basic level layout. It's very simple, just flat ground with cliff walls on either side acting as boundaries. On the left side of the map lies the graveyard, the point at which the enemies will spawn. On the right, the player's house. Inside the player's house is the workshop, where they will craft ammo using scrap.
After this I needed to implement a camera so the player could explore the area. I wanted a bit of a complex camera, one that tracks both the player, and loosely tracks the mouse position as well. Thankfully Cinemachine is insanely good and customisable, and by using a target group Cinemachine script, I was able to do this with relative ease (at least in comparison to doing everything from scratch). There was one last thing I wanted to do, involving locking the camera to a fixed view inside the house. There wasn't much purpose for this apart from style, and I think it was worth it.
Verticality
Now that the basic level is laid out, it really is clear as day. There is 0 verticality in this level. It's gonna get boring quick, for sure. I didn't want to complicate enemy AI with verticality they could encounter, so I needed something for the player only, and preferably temporary. I was thinking about the kinds of things that would exist in the world that could stand in for "temporary platforms". The game is set in the forest, so trees, and their branches felt like a good avenue to pursue. My initial idea for temporary platforms was to just turn off the collisions for the platform like so many others have done, but with branches I saw an opportunity to use hinge joints in a cool way.
So, I went about creating a basic "tree" and "branch" object attached perpendicularly to it. The hinge's movement is clamped to within it's default position and downwards. Alongside this, the motor for the hinge is constantly running, ensuring it always moves towards it's default position. If the player lands on the branch, their downwards force will overwhelm the motors torque momentarily and push it down, but not enough for it to quickly recover and return to it's default position, in a very spring-like manner. This part of the game seems quite fun to the people who played my game, and has a lot of potential as a fun game mechanic.
The next part of this process was to make the branches an actual temporary platform, rather than just a fun springy one. Coroutines made this simple, starting a timer once the player collides with it's hitbox. If the player stays on for the duration of that timer, it "snaps" disabling the motor, and after a brief moment, it's collider. After this, it will reset to it's default position after some time, in a similar manner.
Basic Ammo Crafting
Now, on to the final thing I wanted to do this week: very basic ammo crafting. I had the workshop sprite and the house sprite half done and in the game, and I felt it wouldn't be too much effort to add the basic checks, maths and display for ammo crafting with the way I have structured my code. So I created a script that watched for the 'E' key to be pressed, and if the player is close enough to the workbench within this time. If this is true, then a check occurs in which information about ammo cost stored in the current weapon's data is checked against the player's current scrap. If the player has enough scrap, then the transaction occurs. If the player keeps the E button held down, then ammo continues being purchased at an increasing rate as long as the funds are available.Feedback
I had some good feedback this week, had some people find bugs as mentioned previously which is honestly awesome, in a weird way. Some people also pointed out how sometimes the character's sprite would be clipping through parts of the world in weird ways, and I am very aware of this and unsure of how to approach this. My character's sprite has a very variable size sometimes. I know that colliders can be changed on animations, but changing the shape of the collider for EVERY frame sounds like a really bad idea. So maybe I change the collider to fit the general shape for each animation? I think I am going to look into this. Another piece of feedback was that it was unclear that the house was enterable, which will be fixed by better signposting which I have plans to add later. People also wanted the branches to pop back up faster, which I definitely will do, but is also something where I have no idea what kind of numbers to dial in as I need to test that kind of stuff within the context of an actual... game. Which hopefully will be a big part of next week, where I add enemies, waves, upgrades and such. Big week ahead. Kinda scary. Here's hoping it all goes well!
Files
Grave Mistakes
More posts
- Documentation + User GuideMay 31, 2024
- Week 5 - Polish & UIMay 26, 2024
- Week 4 - Presentation & GraphicsMay 19, 2024
- Week 3 - Enemies & More InteractionsMay 12, 2024
- Week 1 - Basic MovementApr 26, 2024
- Game ConceptApr 16, 2024
Leave a comment
Log in with itch.io to leave a comment.