Final Term: Subject Game Programming
Final Term: Subject Game Programming
Final Term: Subject Game Programming
Registration# Name
Submitted by:
18-CS-16 Laiba Fatima
Obtained Marks:
Ques no 2:
1
Part(a):Demonstrate the difference between:
for various body parts. An illustration of this is on the off chance that you have a lower-body
layer for strolling bouncing, and a chest area layer for tossing objects/shooting.
You can oversee activity layers from the Layers Widget in the upper left corner of the Animator
Controller
Tapping the stuff wheel on the privilege of the window shows you the settings for this layer.
On each layer, you can indicate the cover (the piece of the energized model on which the
activity would be applied), and the Blending type. Abrogate implies data from different layers
will be disregarded, while Additive implies that the activity will be added on top of past layers.
You can add another layer by squeezing the + over the gadget.
The Mask
property is there to indicate the cover utilized on this layer. For instance on the off chance that
you needed to play a tossing movement on the chest area of your model, while having your
character additionally ready to walk, run or stop simultaneously, you would utilize a veil on the
layer which plays the tossing liveliness.
Ques no 3:
using UnityEngine;
void Start()
{
//Get the Animator attached to the GameObject you are intending to animate.
m_Animator = gameObject.GetComponent<Animator>();
}
void Update()
{
//Press the up arrow button to reset the trigger and set another one
if (Input.GetKey(KeyCode.UpArrow))
{
//Reset the "Crouch" trigger
m_Animator.ResetTrigger("Crouch");
//Send the message to the Animator to activate the trigger parameter named
"Jump"
m_Animator.SetTrigger("Jump");
}
if (Input.GetKey(KeyCode.DownArrow))
{
//Reset the "Jump" trigger
m_Animator.ResetTrigger("Jump");
//Send the message to the Animator to activate the trigger parameter named
"Crouch"
m_Animator.SetTrigger("Crouch");
}
}
}
Ans:
Part (d) Consider a scenario where enemy appear from top center of the screen,
and as soon as they reach
Ans:
(d)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
void Start(){
camraObject = GameObject.
FindGameObjectsWithTag("camraObject");
}
rotatingCoords = this.rotation;
transformation.Set(5, 0, 0);
}
void Update(){
if(
Vector3.
Distance(
this.transform.posotion,
camraObject.transform.position
) == 0
){
enemyRotation();
}
}
enemyRotation(){
currentRotation += Input.GetAxis("Horizontal") * Time.deltaTime * 100;
rotatingCoords.eulerAngles = Vector3(0, currentRotation, 0);
transformation.position = rotatingCoords * radius;
}
}