I took part to the game jam in late 2021.
Link to itchio: https://marios-vas.itch.io/john-was-sleeping

Game mechanics that I implemented:
- Movement(Driving, Walking)
- Camera rotation
- Bomb diffusion
- Select button/cable
- Click button/cable
- Hold input in memory/ check input if correct
Each bomb object has a script attached to it that holds user’s input and checks if input is correct. If input is not correct or timer reaches zero bomb explodes.
public class Bomb : MonoBehaviour
{
public float delay = 50f;
public float radius = 5f;
public float force = 700f;
public GameObject explosionEffect;
public bool hasExploded;
public MeshDestroy meshDestroyObject;
public AudioSource audioSource1;
public AudioSource audioSource2;
// Update is called once per frame
void Update()
{
if(hasExploded){
meshDestroyObject.explode = true;
Explode();
}
}
void Explode(){
// We instantiate the explosion where this bomb object is!
Instantiate(explosionEffect, transform.position, transform.rotation);
audioSource1.Play();
audioSource2.Play();
}
}
Bomb types and input check system:
- Bomb with keypad
- Press buttons in correct order to diffuse bomb
- When a button is pressed I append the number depicted on the button to a string. When the string length == 4, an equal check is done between that string and another with the correct password. If they are not equal bomb explodes.
public class ClockBomb_NumPad : MonoBehaviour
{
public bool isEnabled;
public Bomb bomb;
float countdown;
public Transform time_text;
public Transform pass_text;
public string _password;
string passwordInserted;
public void initBomb(){
countdown = bomb.delay;
passwordInserted = "";
isEnabled = true;
}
void Update(){
if(isEnabled){
if (countdown > 0)
countdown -= Time.deltaTime;
else{
boom();
}
time_text.GetComponent<TextMesh>().text = countdown.ToString("F2");
}
}
public AudioSource diffused;
public void checkPassword(){
if(passwordInserted == _password){
//"You diffused the bomb!"
isEnabled = false;
diffused.Play();
}else{
boom();
}
}
public void buttonPressed(int number){
if(passwordInserted.Length <= 3){
passwordInserted += number.ToString();
pass_text.GetComponent<TextMesh>().text = passwordInserted;
if(passwordInserted.Length == 4)
checkPassword();
}
}
void boom(){
//"Boom!!"
bomb.hasExploded=true;
isEnabled = false;
Destroy(gameObject);
}
}
- Bomb with cables(Cut the right color)
- When a cable is clicked it gets cut. If cable is the color needed, bomb is unarmed. If wrong color clicked or timer runs up it explodes.
- Bomb with cables(Cut them in the right order)
- When a cable is clicked it gets cut. There is a list in memory that holds the correct cable’s id to be cut. If the order is wrong or timer runs up bomb explodes.
public class ClockBomb_InOrder : MonoBehaviour
{
public bool isEnabled;
public Bomb bomb;
float countdown;
public Transform text;
int cables_num;
int _indexList;
public List<int> cablesToCutOrder;
public void initBomb(){
cables_num = 4;
countdown = bomb.delay;
isEnabled = true;
}
void Update(){
if(isEnabled){
if (countdown > 0)
countdown -= Time.deltaTime;
else{
boom();
}
text.GetComponent<TextMesh>().text = countdown.ToString("F2");
}
}
public AudioSource diffused;
public void cutCable(int index){
if(cablesToCutOrder[_indexList++] != index){
boom();
}else{
if(_indexList == cables_num){
//You diffused the bomb!
isEnabled = false;
diffused.Play();
}
}
}
void boom(){
//Boom!!
bomb.hasExploded=true;
isEnabled = false;
Destroy(gameObject);
}
void initList(){
int cable_no;
bool found;
for(int i = 0; i < cables_num; i++){
do{
found = false;
cable_no = Random.Range(0,cables_num);
for(int j = 0; j < i; j++){
if(cablesToCutOrder[j] == cable_no){
found = true;
break;
}
}
} while(found == true);
cablesToCutOrder[i] = cable_no;
}
}
}

