Devlog #3 - Interactions


Hey there, welcome to Development Log #3.

This week, I focused on finishing blocking out the base (this has taken faaaar longer than it should have done..), messed around with movement (this is an ongoing problem at this point), found a few bugs, and introduced a few new things.

Dynamic Player Arms and Shooting

Previously, the arms on the player were just a simple child of the player object (with a script to flip the sprite on the X axis depending on positive or negative linearVelocity), but I realised that it might need to be a little more complex to support things like armed/unarmed states, a gun that rotates around a pivot point and follows the mouses aim, and potentially adding future additional guns/gadgets.

I wasn’t quite sure how to implement arm states, and am now realising that I am quickly running out of time to get all this finished, so turned again to Google and ChatGPT for help. ChatGPT suggested making the body and arms children of the main player game object, with an “ArmManager” script that pretty much just enables/disables the relevant game objects. From there, an “arm pivot” object was created with a “gun” as the child – pretty much the same setup as the shield from Invaderoids. At some point I also realised that the bullets weren’t going to spawn from the end of the gun, so after consulting Google, I added another game object at the end of the gun as a point for the bullets to spawn from.

I also realised that when the player flips directions, the arm pivot stayed in the same position which looks mighty odd when walking to the left. I solved this by offsetting the arm pivot point, defining two public point variables (relative to the player), moving the pivot point manually in the Editor to see what the values should be, then setting them in the inspector/code. From there, when the sprite/player flips, we can move the arm pivot to the respective point.

Arm pivot point change

From there, whipped up a quick bullet prefab (the sprite is extraordinarily detailed... just 2x red pixels haha), and tested out shooting. Success. But oh, of course, bullets don't disappear - they stuck to walls like red nerf darts. Yet again, I wasted entirely too long playing with that.


Nerf darts. Also some passing through the ground collider.

To solve this I just added a line to destroy game object in the OnTriggerEnter2D event (and also additional logic to destroy bullet after set timeframe if no collision), then found an animation to play on collision and whipped up a prefab to instantiate from the bullet prefab that plays the animation once.


Shooting!

Doors

The base needed a door, so I set about getting one working. I wanted one that slid up & down to simulate a kind of blast door, with panels either side to open/close the door. For this I knew i'd need two scripts - one on the door to move it up and down (with a state for open/closed and public variables for how far to move it upwards + the speed at which to do so), and another script for the control panels. Working with chatgpt I was able to get this basic implementation working fairly quickly, but quickly realised that I would need to synchronise both panels. I also from there decided I wanted to have multiple panel states for unlocked/locked/powered/unpowered, and also destroyed, with the player able to shoot a panel to short out a powered but locked door.  My intention with powered/unpowered states is to have the player find a power switch for the base exit door before being able to exit - presently unpowered doors can have their panels shot/destroyed, but this does not open the door.


Trying to interact with the door (can't see via gif, but i'm pressing 'E'), then shooting the locked panel to short/open the door

Current Known Bugs/Issues

  • Infinite jumping whilst bouncing off ceilings - turns out this existed in the first builds but nobody found it. Could maybe check if player contact point is touching ceiling in grounded check function? OR, could split currently single collider2D into 2, one for lower half, one for upper half? Doing this would require changing my current code for resizing the collider when rolling, but might actually simplify things
  • Player just bounces around in acid pools, hard to escape (player will die in acid, so this has been low on my to-do)
  • No controls for aiming/shooting on controller
  • When touching a wall & not grounded, movement on away from wall is not possible
  • Enemies sliiiiide along the ground. Need velocity damping or changes to material friction (have been wrestling with friction causing player to stick to walls when velocity into wall is applied)

Infinite roof jumping

What’s Next

I still have a huge (and somehow continuously growing) to-do list:

  • Continue wrestling with movement - on advice from Ian, I am going to try playing with continuous collision detection which should hopefully solve issues with bullets passing through colliders due to the higher velocity.
  • Player health and enemy health, which means also
    • Damage from shooting
    • Death animations
  • Second/Third enemy types
  • Elevators/lifts – I should be able to reuse the scripts for the door & door controllers here, the script has publicly exposed variables for lift height and speed, in theory the same logic applies for a lift.

Some (not all) Player Feedback So Far:

Movement feels amazing, love the rolling and triple jump, if anything to be added, I'd like maybe some combos either rolling into double jump or the opposite, unless the restriction is as intended of course. Good stuff
Taif (taifaa)
Great movement! It feels really fast, and I jumped over the whole right side of the level without even seeing it, so you might want to keep that in mind (as in create more walls or something).
Liam (lawlerl)
Really nice movement and overall vibe. This game has a lot of potential
Ethan (ejduffin)
Movement is very nice. Is the roll function input inspired by Terraria?
Jack (jackl3)
I got stuck here (in the acid pool), I cant move at all but I can shoot
Ooli (osands)
noticed a weird bug which might just be my browser or computer but saw a flicker randomly but gif didnt capture it might just be my monitor refresh rate too high figured id mention it (Note: Referring to tile tearing/bleed, to be fixed!)
btw i liked the door mechanic reminded me of doom
the bullet splash animation is clean too
Phil (parh0)

Leave a comment

Log in with itch.io to leave a comment.