Showing posts with label Alice Posts. Show all posts
Showing posts with label Alice Posts. Show all posts

Tuesday, 14 May 2013

End Game

Here I will be describing the problems we had with our final instalment of vertical slice of our game Dionysus below you can see the first person controller facing outside the house pod. The added in the fog to hide the rendering of the trees as you can see where crossovers are this position of one of the parts and as you can see it is not their. This will be shown once the plant in front has been eaten also below you can see in the bottom right-hand corner. There is the mini map that Alistair made, which shows the position of the controller with red arrow.



below is a closer up image of previous few above, and their health by the top left-hand corner has also got smaller as decreases over time due to your hunger.


one of our main problems was that when you first eat one of the plants. The mini map will disappear forever and will not return. We looked into this and could not find a solution, even though the mini map was successful and worked well due to perhaps encoding it just disappears.and also, as you can see from the plants being eaten apart are described earlier, has now appeared.


below is the pause menu that cat made using the coding as shown on the blog . Unfortunately, due to the lock of the mouse and not coding the buttons to do their own functions. It doesn't work that this show that we were on the verge of finishing it and we needed more time to code


below is a video showing the character, leaving the part eating the plant, seeing the object to pick up and picks it up. This is just shows the basics and the core mechanic of our game.


Problems:
  • Getting the code to work for the health and death zones around Alistairs trees
  • to get the mini map to stay on the screen after plants being eaten
  • getting the pause menu to work
  • having an end game screen or reverting back to menu
Overview:

looking at the vertical slice. We believe that the core mechanic has been shown due to hallucinations from eating the plant to finding a part to the fix your ship. This is the core mechanic of Dionysus . We believe, for the first vertical slice. We have made. This is a great combination of all our knowledge and special skills and a unique talents from Alistair JJ, who mainly focused on 3-D and Alice and Cat who focused on coding and Rebecca, focusing on 2-D. The team had its ups and downs, but overall the vertical slice has come out to be a solid game yet you do not have a death screen and an endgame, but as I said above, the core mechanic of the game has been shown using this knowledge that we have learnt the game that we will make in the third year will be greater than this vertical size due to the knowledge lessons we have learned and all help us a lot in the future

Thanks for your help. Tanguay, Steve and Robin


Health Damage and Health Bar Code


public class HealthBar : MonoBehaviour
{
 //  player's health and health bar
 public float curHP=100;
 public float maxHP=100;
 public float maxBAR=100;
 public float HealthBarLength;


 void OnGUI()
 {
  //  creates the health bar at the coordinates 10,10
  GUI.Box(new Rect(10,10,HealthBarLength,25), "");
  //  determines the length of the health bar
  HealthBarLength=curHP*maxBAR/maxHP;
 }

 void ChangeHP(float Change)
 {
  //  takes whatever value is passed to this function and add it to curHP.
  curHP+=Change;

  // This if statement ensures we don't go over the max health
  if(curHP>maxHP)
  {
   curHP=100;
  }

  // This if statement is to check if the player has died
  if(curHP<=0)
  {
   // Die
   Debug.Log("Player has died!");
  }
 }

 // This function checks if the player has entered a trigger
 void OnTriggerEnter(Collider other)
 {
  // The switch statement checks what tag the other gameobject is, and reacts accordingly.
  switch(other.gameObject.tag)
  {
  case "Heal":
   ChangeHP(5);
   break;
  case "Damage":
   ChangeHP(-25);
   break;
  }
  // Finally, this line destroys the gameObject the player collided with.
  Destroy(other.gameObject);
 }
}


Now we just need to add a timer which Alice is currently looking into :)

using UnityEngine;
using System.Collections;

public class HealthBar : MonoBehaviour
{
 //  player's health and health bar
 public float curHP=100;
 public float maxHP=100;
 public float maxBAR=100;
 public float HealthBarLength;
 private float updateDisplayTime = 0F;


 void Start()
 {
   updateDisplayTime = Time.time + 5F;
 }

 void Update()
 {

        if ( updateDisplayTime < Time.time )
     
   {
         curHP -= 3;
         updateDisplayTime = Time.time + 5F;
   }

    if ( curHP <= 0 )
      {
          this.enabled = false;
      }
 }
 void OnGUI()
 {
  //  creates the health bar at the coordinates 10,10
  GUI.Box(new Rect(10,10,HealthBarLength,25), "");
  //  determines the length of the health bar
  HealthBarLength=curHP*maxBAR/maxHP;
 }

 void ChangeHP(float Change)
 {
  //  takes whatever value is passed to this function and add it to curHP.
  curHP+=Change;

  // This if statement ensures we don't go over the max health
  if(curHP>maxHP)
  {
   curHP=100;
  }

  // This if statement is to check if the player has died
  if(curHP<=0)
  {
   // Die
   Debug.Log("Player has died!");
  }
 }

 // This function checks if the player has entered a trigger
 void OnTriggerEnter(Collider other)
 {
  // The switch statement checks what tag the other gameobject is, and reacts accordingly.
  switch(other.gameObject.tag)
  {

  case "Heal":
   ChangeHP(5);
   break;
  case "Damage":
   ChangeHP(-1);
   break;

   if ( updateDisplayTime < Time.time )
    
  {
        curHP -= 10;
        updateDisplayTime = Time.time + 5F;
  }

   if ( curHP <= 0 )
     {
         this.enabled = false;
     }

  }
  // Finally, this line destroys the gameObject the player collided with.
  Destroy(other.gameObject);
 }
}


The "private float updateDisplayTime = 0F;" we managed to find from one of Alisters lessons, so that there is a counter to how quickly the health decreases when you're near the trees.

Monday, 13 May 2013

Intro Screen

Here is the intro screen.
 
 
Here I was looking at using the rolling credits like in star wars and using the words "A Long Time Ago In A Galaxy Far, Far Away" what the planet dose at the end of the rolling credits is come up close as if your zooming into the planet to where you are.
 

 
 
Part 1

 
Part 2

 
Part 3

 
Part 4

 
Here is the planet zooming in.

Friday, 10 May 2013

Update


Alistair has added a crosshair so that the mouse locks in at the centre of the screen and made assets

JJ has edited sound effects and made assets

Alice has added a health bar, but we are having problems trying to get it so the health gradually decreases, goes up on eating a fruit and goes down on being near the tree's dealing damage or in the water.

I have added extra lighting to the pod and other areas like the AI and cave. Edited the waterfall texture so its showing water falling instead of a spray effect. I found some more sounds and added them to the game however only the ones attached to the first person controller are currently working and we'll need to add the door and eating effects to the code. Added in the assets JJ and Alistair made. Added code for a pause menu but it doesn't completely work with our current code/properly.

Play a sound on Click code

I've found two codes where you click an object and a sound will play:

System.Media.SoundPlayer player = new System.Media.SoundPlayer(@"c:\mywavfile.wav"); < change this part to whatever sound we want
player.Play();



 
private void Button_Click(object sender, EventArgs e)
{
using (var soundPlayer = new SoundPlayer(@"c:\Windows\Media\chimes.wav")) {
soundPlayer.Play(); // can also use soundPlayer.PlaySync()
}
}


 

Health Bar Code

    using UnityEngine;
          using System.Collections;
 
public class PlayerHealth : MonoBehaviour {
 
public int maxHealth = 100;
public int curHealth = 100;
 
public float healthBarLength;
 
// Use this for initialization
void Start () {
 
healthBarLength = Screen.width /2;
 
}
// Update is called once per frame
void Update () {
AddjustCurrentHealth(0); 
void OnGUI(){
 
GUI.Box (new Rect(10,10, healthBarLength, 20), curHealth + "/" + maxHealth);
 
}
 
 
public void AddjustCurrentHealth(int adj)
 
{
 
curHealth += adj;
 
if(curHealth <0)
curHealth = 0; 
 
if(curHealth > maxHealth)
curHealth = maxHealth;
 
if(maxHealth <1)
maxHealth = 1;
 
healthBarLength =(Screen.width /2) * (curHealth / (float)maxHealth);
 }
}
 
I put this code in and the health bar is being shown in the top left hand corner of the screen. I am having trouble at the moment getting it to decrease everytime you go near Alisairs tree's or if you go in the water. It probably needs an if, else statement, Cat when your are next in i'll show you what happens and you might be able to help me get it to work :- )

Yeah the unityanswers this code came from doesnt have any solutions I doubt we are actually going to get this to work

Friday, 26 April 2013

Light/ Colour Script

using UnityEngine;
using System.Collections;

public class DoorControl : MonoBehaviour {

 public bool toggleDoor = false;

 private bool doorOpen = false;
 private const string strOpen = "Open";
 private const string strClose = "Close";

 public TextMesh counterTM;
 private int counter = 0;

 public Light redLight;
 public Light blueLight;
 public Light greenLight;
 public Light orangeLight;

 public int currentCycleState = NONE;
 public float nextCycleTime = 0f;
 public bool enableCyclingOfLights = false;

 //public int countTo4 = 0;

 // Use this for initialization
 void Start () {

 }

 // Update is called once per frame
 void Update ()
 {

  if ( enableCyclingOfLights )
  {
   if ( nextCycleTime < Time.time )
  
   {
   CycleEachLight();
  
   }
  }


  else if (toggleDoor)
  {
   doorOpen = !doorOpen;
 
   if (doorOpen)
   {
    animation.Play(strOpen);
    counter++;
    counterTM.text = counter.ToString ();
  
    // when door is opened and the counter changes
    // check if the lights need to be changed
    UpdateLightsStates( counter );

   }
   else
   {
    animation.Play(strClose);
    counterTM.text = "Closing Door";
   }

   toggleDoor = false;
 
  }
 }

 void CycleEachLight()
 {

  switch ( currentCycleState )
  {
   case NONE:
    SwitchLightOn ( RED );
    currentCycleState = RED;
    nextCycleTime = Time.time + 2f;
    break;
 
   case RED:
    SwitchLightOn ( ORANGE );
    currentCycleState = ORANGE;
    nextCycleTime = Time.time + 2f;
    break;
 
   case ORANGE:
    SwitchLightOn ( GREEN );
    currentCycleState = GREEN;
    nextCycleTime = Time.time + 2f;
    break;
 
   case GREEN:
    SwitchLightOn ( BLUE );
    currentCycleState = BLUE;
    nextCycleTime = Time.time + 2f;
    break;
 
   case BLUE:
    currentCycleState = NONE;
    enableCyclingOfLights = false;
    counter = 0;
    break;
 
 
  }


 }

 void UpdateLightsStates ( int count )
 {
  switch ( count )
  {
   case 2:
    SwitchLightOn ( RED );
    break;
 
   case 4:
    SwitchLightOn ( ORANGE );
    break;
 
   case 7:
    SwitchLightOn ( GREEN );
    break;
 
   case 9:
    SwitchLightOn ( BLUE );
    break;
 
   case 10:
    enableCyclingOfLights = true;
 
    break;
  }



 }

 private const int NONE = 0;
 private const int RED = 1;
 private const int ORANGE = 2;
 private const int GREEN = 3;
 private const int BLUE = 4;


 void SwitchLightOn( int lightToSwitchOn )
 {
  switch ( lightToSwitchOn )
  {
   case RED:
    redLight.enabled = true;
    orangeLight.enabled = false;
    greenLight.enabled = false;
    blueLight.enabled = false;
    break;
 
   case ORANGE:
    orangeLight.enabled = true;
    redLight.enabled = false;
    greenLight.enabled = false;
    blueLight.enabled = false;
    break;
 
   case GREEN:
    greenLight.enabled = true;
    orangeLight.enabled = false;
    redLight.enabled = false;
    blueLight.enabled = false;
    break;
 
   case BLUE:
    blueLight.enabled = true;
    greenLight.enabled = false;
    orangeLight.enabled = false;
    redLight.enabled = false;
    break;
 
 
 
  default:
   //catch all condition
   blueLight.enabled = false;
   greenLight.enabled = false;
   orangeLight.enabled = false;
   redLight.enabled = false;
   break;
 
  }

 }

}

Here is some code Toop and I were thinking of using to make the scene change colour. When you hit the plant, it will make everything that colour.

Friday, 19 April 2013

Respawn Plant Script

#pragma strict

function OnTriggerEnter (other : Collider)
{


 renderer.enabled = false;
yield WaitForSeconds (8);
renderer.enabled = true;

}

Here is the script so that when you encounter the box collider the plant will disappear for 8 seconds and the re-appear.

Wednesday, 27 March 2013

Picking Up Stuff Script!

using UnityEngine;
using System.Collections;
public class PickupObject : MonoBehaviour
{

 public int distanceToTestFor = 10;
 private int foodLayerMask = 1 << 8;  // food layer is on 8, so create a bitmask
 private Vector3 OFF_SCREEN_POSITION = new Vector3(0, -100, 0 );

 // Use this for initialization
 void Start () {

 }

 // Update is called once per frame
 void Update ()
 {
  RaycastHit hit;

  if ( Input.GetMouseButtonDown( 0 ) )
  {
   // cast a ray from the current screen position into the game world
   // to test if it hits an object that we can pick up
 
   if ( Physics.Raycast(Camera.main.ScreenPointToRay( Input.mousePosition ),out hit, distanceToTestFor, foodLayerMask ))
   {
//    hit.transform.position = OFF_SCREEN_POSITION; - this is only needed if you want to respawn the food
//    hit.transform.gameObject.SendMessage("Respawn");
  
    Destroy( gameObject );
   }
 
  }

 }

}

This is the script to be able to actually click on the food (plants) and be able to pick them up. We could use the pool of objects manager script from our coding lessons to respawn the food, but with this code, we will only be able to have lots of food sources which will then be "destroyed" when clicked on.  

I have put up the excersise we did in the coding session today on Dropbox, called excersise10.2, hopefully you will be able to see what we did with all the codes and that.

Friday, 22 March 2013

Green Fog for Underwater Script

using UnityEngine;
using System.Collections;

public class Underwater : MonoBehaviour {

 //This script enables underwater effects. Attach to main camera.

    //Define variable
    public int underwaterLevel = 1064;

    //The scene's default fog settings
    private bool defaultFog = RenderSettings.fog;
    private Color defaultFogColor = RenderSettings.fogColor;
    private float defaultFogDensity = RenderSettings.fogDensity;
    private Material defaultSkybox = RenderSettings.skybox;
   

    void Start () {
     //Set the background color
     camera.backgroundColor = new Color(0.70f, 200, 0.15f, 70);
    }

    void Update () {
        if (transform.position.y < underwaterLevel)
        {
            RenderSettings.fog = true;
            RenderSettings.fogColor = new Color(0.70f, 200, 0.15f, 70);  < This is where we have changed the colour.

            RenderSettings.fogDensity = 0.2f;  < This is where we have changed the density
           
        }
        else
        {
            RenderSettings.fog = defaultFog;
            RenderSettings.fogColor = defaultFogColor;
            RenderSettings.fogDensity = defaultFogDensity;
          
        }
    }
}

Thursday, 21 March 2013

Underwater Script

using UnityEngine;
using System.Collections;

public class Underwater : MonoBehaviour {

//This script enables underwater effects.     //Define variable
    public int underwaterLevel = 1064;

    //The scene's default fog settings
    private bool defaultFog = RenderSettings.fog;
    private Color defaultFogColor = RenderSettings.fogColor;
    private float defaultFogDensity = RenderSettings.fogDensity;
    private Material defaultSkybox = RenderSettings.skybox;

    void Start () {
    //Set the background color
    camera.backgroundColor = new Color(0, 0.4f, 0.7f, 1);
    }

    void Update () {
        if (transform.position.y < underwaterLevel)
        {
            RenderSettings.fog = true;
            RenderSettings.fogColor = new Color(0, 0.4f, 0.7f, 0.6f);
            RenderSettings.fogDensity = 0.04f;
          
        }
        else
        {
            RenderSettings.fog = defaultFog;
            RenderSettings.fogColor = defaultFogColor;
            RenderSettings.fogDensity = defaultFogDensity;
          
        }
    }
}


This is the script we have used for the underwater effect. We have added it to the main camera.

Monday, 18 March 2013

Solar Panel Code

function Update () {
        transform.Rotate(0,2 *Time.deltaTime);
}

This is some code that Alistair found that we could use to rotate the solar panels to make it look like they're following the sun.

Friday, 15 March 2013

Shelf Door Code

var ShelfDoor:GameObject;
var isOpen;

function OnMouseDown()
{

      if(!this.isOpen){
      ShelfDoor.animation.Play("ShelfDoorOpen");
      this.isOpen = true;
}
else
{

       ShelfDoor.animation.Play("ShelfDoorClose");
       this.isOpen = false;

   }
}

This is the code Alistair and I have used to get the shelf doors to open on one click, and close on another click.

Thursday, 14 March 2013

Player Control Script

using UnityEngine;using System.Collections;

public class PlayerControl : MonoBehaviour
{

public GUIText tmMessage;

public GameObject RespawnManager;
public void Died()

{

tmMessage.text = "You have died, respawning...";
 
 //disable first person controller script

gameObject.SendMessage ("SetControllable", false);
//call the cleanup method after 5seconds

Invoke ("CleanUp", 5F); 
}
private void CleanUp()

{

tmMessage.text = "";


//Enable first person controller script

gameObject.SendMessage ("SetControllable", true); 
 //Respawn the player

RespawnManager.SendMessage("RespawnPlayer"); 
}


// Use this for initialization

void Start ()

{

CleanUp();

}


// Update is called once per frame

void Update () {

 
}

}

Here is the other lot of script for the respawn point script.

Respawn Point Script

using UnityEngine;using System.Collections;

public class RespawnManager : MonoBehaviour{

public GameObject[] RespawnPoints;

public GameObject player;


public bool enableRespawnTimer;



// Use this for initialization

void Start ()

{
//InvokeRepeating ("RespawnPlayer", 0, 5F);

}


public void RespawnPlayer ()

{
int randomIndex = Random.Range (0, RespawnPoints.Length);

player.transform.position = RespawnPoints[randomIndex].transform.position;

}



void RespawnPlayerRepeatedly ()

{
if ( enableRespawnTimer )

{
int randomIndex = Random.Range (0, RespawnPoints.Length);

player.transform.position = RespawnPoints[randomIndex].transform.position;

}

else

{

CancelInvoke();

}

}

// Update is called once per frame

void Update ()
{

if (enableRespawnTimer && !IsInvoking ("RespawnPlayer") )

{

InvokeRepeating ("RespawnPlayer", 0, 5F);
 
}

}

}

We could use this code so that if the player dies, they could respawn at the pod and start the game again. With this, you also need to add some code to the PlayerController script, which I wil be posting after this.


Monday, 11 March 2013

Door Script

Tanguy helped me out this morning with coding for the door, as the code we are using in C# is not working properly (even though we don't have any errors). Tanguy showed me how to have a door open when you click on it in Javascript.

function OnMouseDown() {
      animation.Play("DoorOpen");
}

All we need to do is animate the doors opening and closing. We tested this code out on a quick scene with a cube as a door and it works.

HealthControl Script

using UnityEngine;using System.Collections;

public class HealthControl : MonoBehaviour
{   public TextMesh tmPlayerHealth; 

   public int playerHealth = 0;
   private float updateDisplayTime = 0F;
 
// Use this for initialization
void Start ()
 {
 
   playerHealth = 100;
   DisplayHealth();
 updateDisplayTime = Time.time + 5F;

}
void OnDisable()

{

   Destroy( gameObject );

}
// Update is called once per frame
void Update ()
{
   if ( updateDisplayTime < Time.time )
   {

        playerHealth -= 10;

        DisplayHealth();

        updateDisplayTime = Time.time + 5F;

   }
   if ( playerHealth <= 0 )
   {
       this.enabled = false;
   }


}
void OnControllerColliderHit( ControllerColliderHit collisionObj )

{   if ( collisionObj.gameObject.tag == "Enemy" )
   {

        playerHealth--;

        DisplayHealth();

   }



        Debug.Log ("OnControllerColliderHit detected with tag "+collisionObj.gameObject.tag);
 
} // This method is not called when using a CharacterController object
// Use OnControllerColliderHit() method instead

void OnCollisionEnter( Collision collisionObj )
{
    if ( collisionObj.gameObject.tag == "Enemy" )
    {

         playerHealth--;

         DisplayHealth();
    }


Debug.Log (
"OnCollisionEnter detected with tag "+collisionObj.gameObject.tag);

}void OnTriggerStay( Collider colliderObj )
{
    if ( colliderObj.gameObject.tag == "Friend" )
    {

        playerHealth++;

        DisplayHealth();

    }

}
void DisplayHealth()

  {

     tmPlayerHealth.text = playerHealth.ToString();

  }

}


This is the script to control the health when you enter the methane field.

DeathSpot Script

using UnityEngine;using System.Collections; 
public class DeathSpot : MonoBehaviour {
{

    void OnTriggerEnter( Collider hitObj )
      {
       
if ( hitObj.tag == "Player" )

        {

          hitObj.gameObject.BroadcastMessage("Died");


        }


      }

// Use this for initialization

void Start () {

}


// Update is called once per frame

void Update () {



   }

}



This is the script we hope to use for our Methane Field. When the player enters the 'deathspot'/ methane field, their health will depleat.

Monday, 25 February 2013

Monday 25th Feb Group Discussion

Here are the basic tasks we're outlining to be done for Monday 4th March:


JJ: Carry on with the concept art for the terrain and A.I. and have this done for Monday the 4th March? and start working on your plant asset and hopefully have it finished for two weeks time?



Cat and Alice: Working on getting code together (with Alice) e.g. player movement, collider meshes, hopefully some door opening interactions? for Monday 4th March?



Toop: Can you work on moodboards for the textures for the terrain also maybe some concept images for alistairs pod on the inside?  making it look like living quarters? and can you work on your plant asset to have finished for two weeks time as well?


 Alistair: Can you work on getting the terrain set up so we can at least move around in it and add some basic code, add your pod asset and start adding the interior like in toops concept images??
maybe have this almost finished for the 4th of March? if possible?

Friday, 22 February 2013

Puzzle Ideas (Research)

Here are some possible 'out there' puzzle ideas I have been researching. Let me know what you guys think.

1).  Pressing certain keys at specific intervals?

2). Quiz show type thing? where you have to answer questions that pop up on the screen to advance?

E.g. How many legs does a cow have?

A = 1, E = 2, C = 4, and you have to press the right key.

3). A special area could become available after the player reaches a certain point in the game?

4). Cat came up with the idea of having clues.

5). Time limit of how long you have to complete the game itself? Or you could have a time limit just for finding each A.I part?

6). We're already going along with hiding objects (A.I parts).

7). Toop came up with the idea of having "Swirly" objects pop up on the screen and you have to click the right key or number and it will disappear?

Feel free to add anymore that you think of :)

Cat :-
I think incorporating the hallucinations and plants into puzzles would be good, we had the colourblind idea, what about environment changes according to a plant and thats how you advance or  you hear a voice and have to decide whether it is a good or bad voice to follow? ,  i think when they said puzzles they meant in terms of , like spyro, tomb raider, lanoire, looking at your surroundings,
'i need to get from A to B, but somethings stopping me' so how can you over come the obstacle?
Using what we already have to our advantage like the plants can cut down on asset building and the possibility of very hard to find coding.
we can make physical puzzles like pushing blocks i think to do things, the planet doesn't have to be uninhabited , we could just make it so the canyon doesnt have any aliens there but there a some things like ruins and stuff so we can implement ruin type puzzles.