Role: Programmer + Designer
Frankenswoon is a single player, third person platformer in which the player navigates a graveyard as the head of Frankenstein’s monster, collecting hearts in hopes to swoon Ms. Frankenstein’s monster. The movement in the game is heavily influenced by the old toy Mighty Beanz — a small plastic capsule within which resides a small metal ball. It was made over two months in a team of 5 as a project for Vancouver Film School’s game design program. My primary role in the project was as a designer and as the sole programmer.
Frankenswoon
Mass Transfer Code
The movement system relied on adding torque to a capsule and swapping the center of mass to either the top or bottom of the capsule based on the orientation of the capsule. This is a fixed update for when the capsule is grounded.
// set the mass position based on the target masss position
_massPosition = Mathf.Lerp(_massPosition, _targetMassPosition, _massTransferSpeed * Time.fixedDeltaTime);
float previousMass = _targetMassPosition;
// only transfer center of mass if some time has passed since last transfer, to avoid getting stuck on side
if(Time.timeSinceLevelLoad >= _nextTransferTime)
{
// update the target mass position based on whether it is facing up or down
_targetMassPosition = (_bottomOfBean.transform.position.y > _topOfBean.transform.position.y) ? 1 : 0;
_nextTransferTime = Time.timeSinceLevelLoad + _massTransferMinTime;
}
// play a grunt move sound if the target mass position is switched
if (previousMass != _targetMassPosition)
{
_audioManager.PlayMoveSound();
}
// add torque to the rigidbody based on input
_rigidbody.AddTorque(_moveInput.z * _currentMoveForce * Camera.main.transform.right);
_rigidbody.AddTorque(_moveInput.x * _currentMoveForce * -Camera.main.transform.forward);