Professional Documents
Culture Documents
GoodLuck
<Test Game, Concept and Techniques>
1. Game Concept
1) This game is divided into two modes: Easy and Hard.
2) In Easy mode, after every stage, the enemy plane increases by one. In Hard mode, by 3.
3) The speed of the enemy plane in Hard mode increases twice faster than that of enemy
plane in Easy mode.
4) The main plane increases its speed every stage.
5) Left click shoots regular missiles. Right click shoots target missiles. Target missiles do
have a slight delay every click.
6) After a crash with an enemy plane, the camera vibrates and the health is reduced.
7) Every enemy plane destroyed gives 1 point.
8) After traveling a certain distance, it moves on to the next stage.
2. Techniques
1) After subtracting the enemy's position from a main plane's position, I've normalized
the vector and made the enemy plane move towards the main plane.
//
The
direction
from
enemy's
2) In the case of target missile, the initial vector of the target missile would be fired up,
down, left, right, and 4 diagonals. Each target missile will randomly select one and
calculate the direction like we did in 1). Then the target missile will accurately
accelerate towards the enemy plane by shifting the transfomr.foward towards the
enemy plane's position.
Vector3 vMyPos;
Vector3 vRevision;
Vector3 vForward;
Vector3 vDirection;
fAccel;
// The initial directional vector of the target missile must aim up, down, right, left, 4
diagonals like the following:
vRevision.x = 0.0f;
vRevision.x = 100.0f;
vRevision.y = 100.0f;
vRevision.y = 100.0f;
vRevision.z = 100.0f;
vRevision.z = 100.0f;
// Subtracting the enemy's position by the target missile's position will show the direction
that the target missile will point.
vDirection = vEnumyPos - vMyPos;
// Normalize the direction of the target missile with the revising vector to transform the
// vForward must be justified as transform.forward to make sure that the target missile
will point towards the enemy plane.
transform.forward = vForward;
// If the x, y, z component of the vRevision value is greater or smaller than zero, certain
value will be constantly added or subtracted to make it zero.
// As the vRevision value decreases to zero, the fForward will eventually point towards
only with the vDirection value.
if( vShot.x > 0.0f ) vShot.x -= 2.0f; // making the x, y, z component zero.
if( vShot.x < 0.0f ) vShot.x += 2.0f;
euler;
Quaternion
quaternion
transform.rotation.
Transform
myTM
bool
isSideMove
bool
isCollision
float
fCollisionAngle
float
fCollisionTime
float
fTime
// If the eulers.z value is smaller or bigger than a certain value, addition and subtraction will occur
to rotate the main plane on the z-axis as it moves sideways.
// Rotating the plane will rotate the camera as well.
if( isSideMove == true ) {
if( vEuler.z <= 20.0f ) euler.z += 1.0f;
quaternion.eulerAngle = euler;
myTM.rotation = quaternion;
}
// Collision will make isCollision true, the Camera will vibrate for fCollisionTime. Just like the
method written above, shake the main plane on the z-axis.
if( isCollision == true ) {
if( fTime > fCollisionTime ) {
// If fTime value becomes greater than fCollision Time, make isCollision false and
make fTime=0f.
isCollision = false;
fTime = 0f;
}
between -1~1.
fCollisionAngle += Time.deltaTime * 50f;
// If float value is added in Mathf.Sin, it will constantly go back and forth between -1 and
1. Just like a Sin function.
// If Mathf.Sin value is cumulating in the euler.z, -z~+z range will be established. This
value will be added in to the main plane's transform.rotation.
euler.z += Mathf.Sin(fCollisionAngle);
quaternion = euler;
myTm.rotation = quaternion;
}