Breach


Information

August 2021 -December 2021

Engine:C Processing

My Role: Gameplay Programmer and Level Designer


Breach was my first semester project on team of three students. It is a co-op puzzle platformer where you play as two little robots trying to infiltrate the center terminal. It was inspired by Fireboy and Watergirl. I worked in an engine provided by DigiPen where I implemented different systems in C.

What I did on the project:

  • Setup level creation system
  • Designed and implemented all levels
  • Created core gameplay objects
  • Designed and implemented all UI

Team:Andrew Sumanto, Gavin Kay, and Griffon Hanson

Here is a video of some instructors at DigiPen playing through Breach.


Relevant Code Samples

Copyright © 2021 DigiPen (USA) Corporation.

Switch and Switchable Object

This project was the first time I was practically using C to make a game so it was a great learning experience that really accelerated my understanding of the language. This is some code that setups a “switchable” object like a door and a switch for those objects.

/**
 * Creates a Switchable object with the specified parameters.
 * 
 * @param type             The type of Switchable (enum SWITCHABLE_TYPES).
 * @param position         The position of the Switchable.
 * @param width            The width of the Switchable.
 * @param height           The height of the Switchable.
 * @param closedColor      The color when the Switchable is closed.
 * @param callbackOnTouch  The callback function to execute when touched.
 * @param moveDirection    The direction in which the Switchable can move.
 * @param keyType          The type of key required to activate the Switchable.
 * 
 * @return A pointer to the created Switchable.
 */
Switchable* CreateSwitchable(enum SWITCHABLE_TYPES type, Vector2 position, float width, float height, CP_Color closedColor, FunctionPtr callbackOnTouch, enum MOVE_DIRECTIONS moveDirection, enum KEY_TYPES keyType)
{
    Switchable switchable;
    switchable.type = type;
    switchable.moveDirection = moveDirection;

	// Setup the object collider and other properties
    Vector2 zero = CreateVector2(0, 0);
    switchable.collider = CreateCollider(position, zero, width, height, 1, 0);
    switchable.drawnPosition = position;
    switchable.triggerState = 0;
    switchable.closedColor = closedColor;
    switchable.key = keyType;

    // Check the type of Switchable
    if (type == SWITCHABLE_GAP)
    {
        switchable.triggerState = 1;
        switchable.collider->isTrigger = 1;
    }
    else
    {
        switchable.triggerSound = CP_Sound_Load("./Assets/silence.wav");
    }

    // Check if a key is required and if it's obtained
    if (keyType != KEY_NONE && IsKeyObtained(keyType))
    {
        switchable.triggerState = 1;
        switchable.collider->isTrigger = 1;

        switchable.triggerSound = CP_Sound_Load("./Assets/silence.wav");
        CP_Sound_Play(switchable.triggerSound);
    }

    switchable.callbackOnTouch = callbackOnTouch;

    // Add the created Switchable to the switchableList
    switchableList[numSwitchables] = switchable;
    numSwitchables++;

    // Return a pointer to the last created Switchable
    return &switchableList[numSwitchables - 1];
}

/**
 * Creates a Switch object with the specified parameters.
 * 
 * @param type             The type of Switch (enum SWITCH_TYPES).
 * @param position         The position of the Switch.
 * @param width            The width of the Switch.
 * @param height           The height of the Switch.
 * @param switchable       The associated Switchable.
 * @param timeInSeconds    The time interval for toggling the switch.
 * @param exclusive        Flag indicating if the switch is exclusive.
 * @param moveDirection    The direction in which the Switch can move.
 * 
 * @return A pointer to the created Switch.
 */
Switch* CreateSwitch(enum SWITCH_TYPES type, Vector2 position, float width, float height, Switchable* switchable, float timeInSeconds, int exclusive, enum MOVE_DIRECTIONS moveDirection)
{
	// Switch properties
    Switch switch;
    switch.type = type;
    switch.moveDirection = moveDirection;
    switch.pressedOriginalPosition = position;
    switch.exclusive = exclusive;

	// Setup object properties
    Vector2 zero = CreateVector2(0, 0);
    switch.collider = CreateCollider(position, zero, width, height, 1, 0);
    switch.drawnPosition = position;
    switch.triggerState = 0;
    switch.switchable = switchable;
    switch.toggleTime = timeInSeconds;
    switch.triggerSound = CP_Sound_Load("./Assets/Switch.wav");
    switch.unTriggerSound = CP_Sound_Load("./Assets/SwitchReverse.wav");

    // Check the type of Switch
    if (type == SWITCH_PRESS)
    {
        Vector2 offset = CreateVector2(switch.collider->point2.x, 0);
        switch.leftCollider = CreateCollider(add(&position, &offset), CreateVector2(0, 0), width * collisionWidth, height * collisionHeight, 1, 0);
		
        offset = CreateVector2(switch.collider->point1.x, 0);
        switch.rightCollider = CreateCollider(add(&position, &offset), CreateVector2(0, 0), width * collisionWidth, height * collisionHeight, 1, 0);
    }
    else
    {
        switch.leftCollider = NULL;
        switch.rightCollider = NULL;
        switch.collider->isTrigger = 1;
    }

    // Add the created Switch to the switchList
    switchList[numSwitches] = s;
    numSwitches++;

    // Return a pointer to the last created Switch
    return &switchList[numSwitches - 1];
}
Proudly powered by WordPress | Theme: Outfit Blog by Crimson Themes. Globe Vector and Kiwi Bird Logo Vectors by Vecteezy