Game Dev 1
Game Dev 1
Student name:
2. To make the game independent of the speed of the system on which it runs:
a) Use higher level libraries
b) Use mathematical optimization functions
c) Use a time step proportional to frame rate
d) Use a time step inversely proportional to frame rate
Page 2 of 6
Question 2 [35 pts]: Write the pseudocode of a script that does the following:
1. Create a cylinder and a cube. Position and scale as shown in the figure.
Page 3 of 6
Page 4 of 6
Question 3 [35 pts]: Explain what the following code is doing. Draw a rough sketch of the scene after
this code runs.
void Start()
{
float radius = 10;
int n = 20;
float d_alpha = 360f / n;
float alpha = 0;
for (int i = 0; i < n; i++){
alpha += d_alpha;
Quaternion rotateAround = Quaternion.Euler(0, alpha, 0);
Vector3 disp = rotateAround * (Vector3.right * radius);
GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
cube.transform.localScale = new Vector3(3, 1, 1);
cube.transform.Rotate(0, alpha, 0);
cube.transform.position = disp;
}
}
Page 5 of 6
Page 6 of 6