Twin Stick Shooter

Published by mark on

Twin stick Shooter project.

Meta Data

Teamsize: 2 devs, 2 artists

Project Length: 10 weeks

Duties: programming > player(movement, interaction), AI(everything AI related), Menu’s, UI in game.

Engine: Unity

Twin stick shooter project is a game created by me and 3 others from my study.In the game you are a special agent send to eliminate a virus that mutates people into scary beasts who attack and only spread the virus. you need to fight through rooms full off mutants to then in the end kill a boss.

Video

Sample Code

The sample code if of a door.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Door_parrent : MonoBehaviour {


    [SerializeField]
    public bool _locked;
    protected float _open_timer;
    [SerializeField]
    private bool _is_door_that_require_a_key;
    [SerializeField]
    GameObject item_to_open;
    [SerializeField]
    private float _time_to_be_opend;
    [SerializeField][Header(" ON = can only open when lights are on, OFF = can only open when lights are OFF")]
    private string _Lights_Need_to_be_On;
    [SerializeField][Header("vul dit in als je voor de locked door een custom sentence wil.")]
    private string Custom_locked_text;
    protected virtual void Start () {
        _open_timer = 0;
        if (_time_to_be_opend == 0)
            _time_to_be_opend = 1.5f;

    }
	
	protected virtual void Update () {
        if (_open_timer > 0)
            _open_timer -= (1 * Time.deltaTime);
    }
    protected virtual void OnTriggerEnter(Collider other) { }
    protected virtual void OnTriggerStay(Collider other)
    {
        if ((other.gameObject.tag == "Player" || other.gameObject.tag == "Enemy") && !other.isTrigger)
        {
            if (other.gameObject.tag == "Player")
            {
                selfwritten_inventory inventory = other.gameObject.GetComponent();
                if (_is_door_that_require_a_key)
                {
                    if (_is_door_that_require_a_key && Input.GetKeyDown(KeyCode.E))
                    {
                        foreach(GameObject i in inventory.Get_inventory_items)
                            if(i.gameObject.name == item_to_open.name)
                            {
                                inventory.Remove_from_inventory(i);
                                Destroy(i);
                                Game_overlay_ui.Create_Message("Door opened, Lost a " + item_to_open.name, 0.01f);
                                _is_door_that_require_a_key = false;
                                break;
                            }
                    }
                    bool result = false;
                    foreach (GameObject i in inventory.Get_inventory_items)
                        if (i.gameObject.name == item_to_open.name)
                        {
                            result = true;
                            break;
                        }
                    if (result)
                    {
                        Game_overlay_ui.Create_Message(@"Want to open this door?
Press E to open", 0.01f);
                        return;
                    }
                    else
                    {
                        Game_overlay_ui.Create_Message("This door is locked requires a " + item_to_open.name, 0.01f);
                        return;
                    }
                }


            }

            bool Light_setting_on;
            switch (_Lights_Need_to_be_On)
            {
                case "ON":
                    Light_setting_on = false;
                    break;
                case "OFF":
                    Light_setting_on = true;
                    break;
                default:
                    Light_setting_on = Light_switch.Status;
                    break;
            }

                    
            if (!_locked && Light_switch.Status == Light_setting_on)
            {
                _open_timer = _time_to_be_opend;
            }
            else if (!_locked && Light_switch.Status != Light_setting_on)
            {
                string Message = "Power needs to be " + _Lights_Need_to_be_On  + ",\nin order to open this door."; 
                if (Game_overlay_ui.Get_Message != Message)
                {
                    Game_overlay_ui.Create_Message(Message, 1f);
                }
            }
            else if (_locked && transform.parent.parent.gameObject.name != "lift v2")
            {
                _open_timer = -_time_to_be_opend;
                string Message = "";
                if (Custom_locked_text == "")
                    Message = "this door is locked.";
                else
                    Message = Custom_locked_text;
                if (Game_overlay_ui.Get_Message != Message)
                {
                    Game_overlay_ui.Create_Message(Message, 1f);
                }
            }
        }
    }
}

}
Categories: Project