Skip to main content

Game Jam #2 - Van Helsing (PART 4) - More Functionality

Continuing on from the last log:


The Ghost

The purpose of the ghost is simple: to keep the player moving. Although not refined, there are elevated platforms the player can stand on in the level (i.e. the Statues and Lampposts) and one issue we identified quite early is that the player could take advantage of this to avoid the zombies indefinitely by remaining in one 'safe' spot until they had killed all the zombies. To rectify this, we created the idea of the ghost - an enemy that could reach the player on any y level and could not be killed. They have a delayed start to give the player some time to get moving and then, if not progressing quick enough, the ghost will eventually catch up to the player and nudge them along (or kill them if they fail to do so).

 
 
Creating the delay was simple. On level start, the ghost spawns just off-screen with the variable "begin" set to false. Inside the _process function, everything is behind an if statement waiting for begin to be true before proceeding, meaning that the ghost stands frozen until then. On the first line of executed code, the function "await" is called with the process get_timer(). This sets up a one-time timer that only runs once per application execution and will never run again (even if you run the line again, it will just pass it). In this scenario, I found it more efficient than using a node since a one-time timer is all I needed but for most situations, I do recommend using the proper Timer node in Godot.

 
 
The code for the ghost's x-axis is identical to that of the zombie's but now below it there's some for the y aswell. Since the sprite does not have to change based on the y-axis position like it does for the x, it can be simplified into 1 line of code. Damage and collision for the ghost is handled by the Player so there is no code for it here.

And that's it. That's the ghost. A simple addition, but one I feel is integral to the gameplay.


Importing the Animations



My final task for the game was to take all the (amazing) animations created by our artist and make them work inside the game. Luckily for me, Godot has a very well-built Sprite and animation editor that allowed me to very quickly import and fine-tune the animations. With them all set up, all I had to do was correctly call them inside the appropriate scripts.

That was with one exception: the zombie's death animation. This was a little different since after losing all health, the zombie needed to fall to the ground and remain there forever as a corpse.


By default, animations will play on an infinite loop until a new animation is called for. For most actions like walking this is perfectly fine, but for death, it poses a problem since it's only meant to play once and there is nothing that follows it. With the corpse, there were collision issues that needed to be sorted as without deleting the object, "Zombie_Area2D" still existed for the player to collide with.

The solution I engineered involved the use of a boolean variable called 'dead' which would start false and only be changed once: after the death animation. Upon the zombie losing health, if 'dead' had not already been triggered, the collisions would be disabled using a built-in command, the death animation would play and another one-time timer from the await function would activate. The timer is set to the length of the animation so that it has time to play before moving on, as without it, the next animation would get played instantly and cut off the one before it. Once the timer times out, dead is set to true.

In a different if statement, the value of dead is checked each frame. If false, the rest of the zombie code is executed as normal, but if true, then the animation "corpse" (which consists of only one frame - a zombie corpse) is played infinitely. Once triggered, this is the state the zombie remains in for the rest of the game.

Here's a video of how it looked once implemented:



And with that, my contributions were (almost) complete! At this point, the project was sent off to the other programmer who added all their bits and made it look amazing. And while they succeeded in the end, it is important to note that they reported sizeable challenges in trying to find information online about the particle and lighting systems due to Godot being a less well-known engine with a smaller community and its documentation being less helpful than it perhaps could be (along with their own technical challenges like mine).

After this, my only remaining input on the project was on submission day when I quickly whipped up functioning Menu, Game Over and Victory screens as well as designing the final level due to the absence of our designer.

And with that, I only have the reflection left to record. 
 
See you in the final log,
 
- JDM

Comments

Popular posts from this blog

Game Jam #2 - Van Helsing (PART 2) - The Bullets

  (Bullet sprite by Nicolas Katsis) This part is solely on how I implemented the bullets shown in the video in Part 1. There are two parts to this split across two scripts. The first is its behaviour and the second is the spawning of the bullet. First of all, it's behaviour.   The first thing that occurs on spawn is that the bullet assigns itself to a group of objects known as "P_Bullet". You will notice in all the snippets of code that many of the variables and groups for this object are listed as "P_ something ". This is because we initially considered the idea of giving the player two different guns that they could swap between: A pistol with a higher ammo count and longer range but weaker damage, and a shotgun with a much higher damage but fewer bullets and shorter range. The P_ was a reference to 'Pistol' bullets and S_ was a reference to 'Shotgun' bullets. Unfortunately, due to time constraints, the Shotgun was never introduced. For those u...

Demigod - CSGO - Update 1

The 'player' with a cylinder to identify its front face As part of this teaching blocks assignment for my Coding & Scripting for Games module (nicknamed CSGO...we don't talk about the O) I have to make a simple game or game system inside Unreal Engine 5. This is a solo project that everyone has to do individually but as the focus is on the code, things such as appearance and presentation are not important, lightening the workload. My idea for this project is simple: I intend to make a 3D platformer wherein the player has a dash and double jump ability which can be stringed together for impressive world traversal. At first, you may think that's too easy, UE5 already has most of that built-in...until I say that I intend to program it all myself. Why am I doing that? Because of how the built-in versions work. Jumping, for instance, uses the advanced physics engine which makes it momentum based. You need to run/sprint before you jump or else you will go nowhere. Not onl...

Game Jam #2 - Van Helsing (PART 1) - The Beginning

  Game Jam #2 began on 13th October and lasted 3 weeks. The goal this time was "Shoot-em up" and the teams had been both expanded to average 4 per group and randomly assorted as opposed to being grouped based on those around you. My team consisted of the following: - Programmer (me) - Programmer - Artist - Designer  Off the bat, we were able to come up with a very solid idea for our game: A side-scrolling platformer where the player can shoot 360 degrees to kill zombies. The player can only see inside a small aura of light around them and must rely on lampposts and other light sources as well as directional audio cues to navigate the level. The other programmer, just like my last partner, had never used a game engine prior to this course. As such, we settled on using Godot for this project. The reason we chose Godot is because its proprietary scripting language, known as GDscript, is pythonic. This means it is eerily similar to python, but enhanced and integrated enough that ...