Monday, 24 February 2014

Starting level video


This is a video of my starting area in this level:

Main mechanic of enemy following

I have now added the main mechanic of the enemy to follow the player. I got the code from this site but I have added some modifications and fixed errors in the code. This is the code below:



using UnityEngine;
using System.Collections;

public class EnemyFollow : MonoBehaviour {
public Transform target;
public int moveSpeed;
public int rotationSpeed;
public int maxdistance;
private Transform myTransform;

void Start(){
myTransform = transform;
}

void Update () {
if (Vector3.Distance(target.position, myTransform.position) < maxdistance)
{
// Get a direction vector from us to the target
Vector3 dir = target.position - myTransform.position;

// Normalize it so that it's a unit direction vector
dir.Normalize();

// Move ourselves in that direction
myTransform.position += dir * moveSpeed * Time.deltaTime;
}
}
}




The distance from the player to begin movement of the object and speed of the object can be edited on the right panel of the script as shown below:

Sunday, 23 February 2014

More Trees

I have now added more trees to make the forest type area a lot more dense. Instead of using all the same type of tree I have added colliders to a variety of tree types, the same way as before, and mixed these tree types together across the landscape.

Monday, 17 February 2014

Trello




















I have created a Trello account to keep track of my progress, what I need to do, what I have done, and what I am doing. This helps me organise my project and allows me to see clearly what must be done.


Colliders on the crashed plane


I have now added colliders to the crashed plane so the player can no longer walk through this plane.

I added these colliders to the plane in the same way as I did on the trees in the area. This time I used multiple colliders on the plane to cover it affectively.




Adding spin to propeller

I have added spin the crashed planes broken propeller as an extra feature of the starting area.

Below is the simple C# code I used to add the spin to the propeller:


using UnityEngine;
using System.Collections;

public class Propellerspin : MonoBehaviour {

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
transform.Rotate(Vector3.up * 3);
}
}

Starting Area

I have used multiple planes to create the starting area as I could not separate the parts of the plane to create the area. Therefore I have moved and manipulated the planes to arrange them in the way needed to make it look like a plane crash site. I have also used the particle effects in the unity engine to add fire to the crash site as seen below.


Aircraft

I downloaded an aircraft pack from the Unity asset store. That pack was called "World WarII P47 thunderbolt."

Below is an image of the planes included in the pack:


Adding colliders to trees







To add a collider I selected the tree went to the component menu then to physics and to the collider depending on what shape you require.










A collider will be added as a green outline to the object. This can be resized using the menu to the right. The width, height and position can be changed.









One the collider has been placed, create a prefab, add the tree to the prefab and click apply. You now have a collider to all the trees in this prefab.

Adding Boundaries

I have added boundaries to level in the form of water. The entire island is surrounded by water and at the waters edge I have added invisible walls to prevent the player walking off the edge of the map. I did this by adding empty game objects and placing them around the edge of the map.


Terrain Toolkit

I have created the snowy environment for my level by adding an asset to the project called the 'Terrain Toolkit.' This was used to randomly generate the environment, such as hills, the link for this download is below:

https://code.google.com/p/unityterraintoolkit/downloads/detail?name=Terrain%20Toolkit%201.0.2.zip&can=2&q=

Once downloaded you simply drag the folder into the assets folder of your unity project.
You then add the terrain toolkit component to your terrain.


Here you can see the terrain toolkit component to the right of the screen.

Game Idea

My game takes place on a snowy, hilly, island environment. You play as a crashed aeroplane pilot who has been stranded  on this island. They must get to the evacuation site on the other side of the island where there is a waiting helicopter. Along the way the player must battle dense forest, abandoned buildings, snow storms and creature that are located on the island. The enemies will only attack when the player gets within a certain radius of them or shines the torch they have on the enemy. The player must then run from creatures to escape from them before they are killed.