Fog of war, Gamepause, Bosses and healing weld

Greeting adventurer!

Today I will show you how Fog of war, gamepause, bosses and healing weld is implementet.

First, Fog of war:

We have made a prefab FOW which is a sprite renderer with a black square and a box collider. Next, we create a new prefab, called FOWManager which have a script that takes FOW as input. This script runs though a 2D for-loop and create new gameobjects of the black square.

 void Start () {
height = 16;
width = 16;
FOWHolder = new GameObject ("FOWHolder");
for (float i = 0; i < height; i+=0.32f) {
for(float j = 0; j < width; j+= 0.32f){
Vector2 pos = new Vector2 (i,j);
GameObject g = Instantiate(prefab, pos, Quaternion.identity) as GameObject;
g.transform.parent = FOWHolder.transform;



Just a little notice on how Bosses is made. They are made in exactly the same way as the other enemies, but it have its own melee attack script and animation.

public class meleeAttack : MonoBehaviour {
private int attackDamage;
Animator anim;
GameObject player;
EnemyStats estats;
private float attackStart;
private float attackCD;
// Use this for initialization
void Start () {
player = GameObject.Find ("Player");
anim = GetComponent<Animator> ();
estats = GetComponent<EnemyStats> ();
attackCD = 1.0f;
attackStart = 0.0f;

// Update is called once per frame
void Update () {
if (anim.GetBool ("isAttacking") && Time.time > attackStart + attackCD) {
attackDamage = estats.GetAttackDamage();
attackStart = Time.time;


We have recently added functionality for pausing the game. This is actually very simple. First, I went to “mspaint” and paintet a pause symbol. Then I created a prefab(gameobject with paintet image in a sprite renderer). Next, I created a script in “MoveableCharacters” with these lines:

 void Update(){
if (Input.GetKeyDown (pauseKey) || Input.GetKeyDown (KeyCode.Joystick1Button7)){
if(Time.timeScale > 0.5){
pObj = Instantiate(pauseImage,player.transform.position,Quaternion.identity) as GameObject;
Time.timeScale = 0;
Time.timeScale = 1;

2015-12-12 (3).png

Picture show pause picture(black one), healing weld(blue square) and bosses(red and green Golem).

Healing weld:

We have created a healing weld. If the player stands in the weld, it will slowly heal, 1 health per 0.1 second. This is just a sprite renderer (the blue one in the picture above),  a polygon collider and a small script which add 1 health to the player if Time.time > time + cooldowntime.


Best regards

P219 Development Team


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s