In this dark fantasy game, you play as a warrior striving to hold back the encroaching Darkness. Despite your best efforts, hope is fleeting, and the odds are stacked against you. Luckily, Goddes is helping you, but even then, is it even possible to beat Darkness?

Update:

Unfortunately, even though I said I would continue this project, I don't think I'll be able to create what I wanted with it. The code is just really messy. I'm not saying I'm abandoning this project—absolutely not. I'll just recreate this game with clearer code and a better understanding of what I want to achieve.

Right now, besides this project, I'm working on another board game (I'll post it after adding basic graphics and polishing the gameplay a bit more). But aside from that, I still want to focus on this project.

Here is the list of things I'd like to change/add to the new version of the game:

  • Level-up system: Originally planned during the game jam, now I'll have time to implement it better and more polished.
  • More types of enemies: The enemies in the base game are pretty boring, so I'm going to add more variety.
  • Light: A new resource that you'll lose over time. You'll be able to regain it next to the Goddess's lanterns. Less light means less visibility and more powerful foes.
  • And more!

Thank you for all the support you've given me in the comments—it really means a lot to me.

Credits:

Music: "Stay the Course" Kevin MacLeod (incompetech.com)
Licensed under Creative Commons: By Attribution 4.0 License
http://creativecommons.org/licenses/by/4.0/


As for the game jam, my code is compacted, but not into one line 

For that i set myself a golden rule: after ; you can't put anything apart from }

So, anyways, here are the codes:

Player Script:

using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEditor;
using UnityEngine;
using UnityEngine.PlayerLoop;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class PlayerScript : MonoBehaviour
{
    [SerializeField] float speed = 1.5f, atkSpeed = 2f, projSpeed = 2f, timer = 0f, immunityTimer = 0f, immunityTimerBase = 1.5f, deathTimer = 0f;
    public float hp = 30f, maxHP = 30f, damage = 2f, score = 0f;
    public GameObject magicBullet, HPBar, attackBar, darkScreen, resetButton, endText, scoreText;
    void Start() {darkScreen.SetActive(false);
        resetButton.SetActive(false);
        endText.SetActive(false);
        scoreText.SetActive(false);
        Time.timeScale = 1f;
        hp = maxHP;
        deathTimer = 0f;}
    void Update() {transform.position += new Vector3(Input.GetAxis("Horizontal") * speed * Time.deltaTime, Input.GetAxis("Vertical") * speed * Time.deltaTime, 0f);
        timer -= Time.deltaTime;
        immunityTimer -= Time.deltaTime;
        if (hp <= 0f) {deathTimer += Time.deltaTime;
            darkScreen.SetActive(true);
            darkScreen.GetComponent<Image>().color = new Color(0, 0, 0, deathTimer * 1.5f);
            if (deathTimer > 2f)
            {
                Time.timeScale = 0f;
                scoreText.SetActive(true);
                resetButton.SetActive(true);
                endText.SetActive(true);
                scoreText.GetComponent<TextMeshProUGUI>().text = "Score: " + score.ToString("F0"); }}
        else { HPBar.GetComponent<Slider>().value =hp / maxHP; }
        if (timer < 0f) { attackBar.SetActive(false);}
        else {attackBar.GetComponent<Slider>().value = (atkSpeed - timer) / atkSpeed;
            attackBar.SetActive(true);}
        if (Input.GetMouseButtonDown(0) && timer <= 0){timer = atkSpeed;
            GameObject missile = Instantiate(magicBullet, transform.position, Quaternion.FromToRotation(Vector3.up, (new Vector3(Camera.main.ScreenToWorldPoint(Input.mousePosition).x, Camera.main.ScreenToWorldPoint(Input.mousePosition).y, 0f) - transform.position).normalized));
            missile.transform.position += missile.transform.up * 1.5f;
            missile.GetComponent<Rigidbody2D>().AddForce(missile.transform.up * projSpeed, ForceMode2D.Impulse);}}
    public void dealDamage (float damage){if (immunityTimer < 0f) {immunityTimer = immunityTimerBase;
            hp -= damage;}}
    public void ResetTheGame (){Time.timeScale = 1f;
        SceneManager.LoadScene("Arena");}}


Enemies script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemyController : MonoBehaviour{public GameObject player;
    [SerializeField] float speed, rotation;
    [SerializeField] float damage, hp;
    void Update(){transform.position = Vector2.MoveTowards(transform.position, player.transform.position, speed * Time.deltaTime);
        transform.Rotate(new Vector3(0f, 0f, rotation * Time.deltaTime));}
    private void OnCollisionEnter2D(Collision2D collision){
        if (collision.gameObject.tag == "Player"){collision.gameObject.GetComponent<PlayerScript>().dealDamage(damage);}
        else if (collision.gameObject.tag == "Bullet"){Destroy(collision.gameObject);
            hp -= player.GetComponent<PlayerScript>().damage;
            if (hp < 0){
                player.GetComponent<PlayerScript>().score++;
            Destroy(gameObject);}}}}

Game Controller:

using System;
using System.Collections;
using System.Collections.Generic;
using Unity.Mathematics;
using UnityEngine;
public class BoardController : MonoBehaviour{[SerializeField] float EnemiesPerSecond = 1f, timer = 0f, SpeedUp = 0f, yHeight = 6f, xWidth = 10f;
    [SerializeField] GameObject player, enemiesAvaiable;
    private void Update(){timer -= Time.deltaTime;
        if (timer < 0f){while (timer < 0f){Vector3 spawnPos;
                if (UnityEngine.Random.Range(1, 3) == 1){if (UnityEngine.Random.Range(1, 3) == 1){spawnPos = new Vector3(-xWidth, UnityEngine.Random.Range(-yHeight, yHeight), 0f);}
                    else{spawnPos = new Vector3(xWidth, UnityEngine.Random.Range(-yHeight, yHeight), 0f);}
                }else{if (UnityEngine.Random.Range(1, 3) == 1){spawnPos = new Vector3(UnityEngine.Random.Range(-xWidth, xWidth), -yHeight, 0f);
                    }else{spawnPos = new Vector3(UnityEngine.Random.Range(-xWidth, xWidth), yHeight, 0f);}}
                GameObject enemy = Instantiate(enemiesAvaiable, spawnPos + player.transform.position, Quaternion.Euler(Vector3.zero));
                enemy.GetComponent<EnemyController>().player = player;
                timer += 1 / EnemiesPerSecond;}
            EnemiesPerSecond += SpeedUp;
            timer = 1 / EnemiesPerSecond;}}}

Download

Download NowName your own price

Click download now to get access to the following files:

Darkess Is Comming.zip 33 MB

Leave a comment

Log in with itch.io to leave a comment.