Saturday, April 9, 2011

Game Object

David, Alex, Ryan, Dan

GAME365 - World Building

Milestone 2

Marie Broyles

Game Objects

Overview:

218 years after the original Golden Fleece of King Louis XV was stolen and broken, it was reconstructed and presented by Herbert Horovitz. This now reconstructed piece is being moved to our museum for a viewing event. Using only his wits and a flashlight we will be making an attempt to steal the amazing piece of history. Along with the reconstructed Golden Fleece on display is the Maire-Antoinette Blue Diamond and earrings. Though also very valuable these items will only act as a bonus to the steal able items.

Here are some art references;

First items that can be stolen:

The Blue Diamond

The Earrings

The Flashlight:

You will hold this flashlight for duration of level. It may be needed on other levels to advance to new areas.

Then the main Item for this level:

The Golden Fleece

On our map:

If player is seen while in the brown circle area then the doors will remain shut. If you remain detected longer than 10 seconds then game is over. You will need to start over.

AI coding:

This is the movement code for the AI – shows wall detection and then will turn around 180 degrees – this is for the first and third enemy room areas

var turnSpeed : float = 5;

var speed : float = 10;

var distanceToGo : float =5;

var leftOrRight : boolean = true;

function Update(){

if(Input.GetKeyDown(KeyCode.E)){

if(leftOrRight)

leftOrRight = false;

else

leftOrRight = true;

}

var hit : RaycastHit;

var fwd : Vector3 = transform.forward;

if(Physics.Raycast(transform.position, fwd, hit, distanceToGo)){

if(leftOrRight)

transform.Rotate(Vector3.up, 180 * turnSpeed * Time.smoothDeltaTime);

else

transform.Rotate(Vector3.up, -180 * turnSpeed * Time.smoothDeltaTime);

}

else{

transform.Translate(Vector3.forward * speed * Time.smoothDeltaTime);

}

}

This is my work in progress on player detection / attack

//Move to or attact a target

var target : Transform;

//movement speed

var moveSpeed = 2;

//rotation speed

var rotationSpeed = 4;

// distance to detct attack/detection

var attackThreshold = 6;

// distance to start movement to player

var chaseThreshold = 10;

// distance for enemy to stop going to player

var giveUpThreshold = 15;

// delay in process on attack/detection

var attackRepeatTime = 0;

var explosionPrefab : Transform;

//current movement to player is false

private var chasing = false;

private var attackTime = Time.time;

// the enemy

var myTransform : Transform;

function Awake()

{ myTransform = transform; }

function Start()

{

// this coild be the detection to player

//target the player target = GameObject.FindWithTag("Player").transform; }

function OnCollisionEnter(collision : Collision) {

//The detection of possible hits (will use seconds of time once make that code

/*countenermyhits++;

if(countenermyhits == 3){*/ Destroy (gameObject);

//} }

function Update ()

//Still working on this part for an update of current actions

// While have in real time process soon

{ // check distance to player

var dist= (target.position - myTransform.position).magnitude; if (chasing) {

//rotate to look at the player ----

myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime);

//move to the player ----

myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;

// if enemy is now to far away ---

if (dist greaterthan giveUpThreshold) { chasing = false; }

// detect if close enough ----

if (dist lessthan attackThreshold && Time.time greaterthan attackTime) {

// Attack/Detection Start ----

Instantiate(explosionPrefab,transform.position, transform.rotation); Destroy (gameObject); attackTime = Time.time + attackRepeatTime; } }

else {

// start chasing if target comes close

if (dist lessthan chaseThreshold) { chasing = true; } }

}

Work cited:

http://factoidz.com/the-fabulous-jewelry-collection-of-marieantoinette/ (both images and descriptions’)

http://lookyhereu.blogspot.com/2008_11_01_archive.html (maglight image)





1 comment: