LECTURE:
On our second week of the course, our lecturer went through tips and tricks we could use for our game. We went through script functions - Awake(), FixedUpdate(), Start(), etc. - and explained to us what each function did and when they would be best to be implemented or used.
In the image above, void Start() and private void Awake() can be seen. The Awake() function would initialize as soon as the game scene has been executed, whereas void Start() would start when the game object have been spawned into the scene. In this example, I have used a SetActive - another keyword/function we learnt - for a pause function in a project.
Along with scripting functions, our lecturer also covered velocity and a more realistic control or mechanic for the actual jetpack with a function called Rb.AddForce. To access the function .AddForce, first we need to access the game object's rigidbody component, and that can be done by the function [Name of variable here] = GetComponent<Rigidbody>() or a public Rigidbody [Name of variable] here.
The image above is an example that I made after following the lecturer. Here, I have made a variable of the rigidbody component, and called it player. By having this component, I can then proceed to add in the force for the jetpack. public int up was used with Time.deltaTime - change in time - for the acceleration. This allowed the game object (or in this case the player) to jump up and down as if there were a jetpack attached to it.
MILESTONES & ACHIEVEMENTS:
From last week, I managed to put in whatever we went through on our last lecture, into simple practices with small pieces of code and other modules which require codes, such as GAM112. I found that this module helps out a lot with other modules as I learn new things and functions that can be used to add on more mechanics on future projects. For this week's milestone, and possibly the few weeks after the next, I would be working on the first assignment, allowing me to evaluate my work faster and learn where I went wrong.
On our second week of the course, our lecturer went through tips and tricks we could use for our game. We went through script functions - Awake(), FixedUpdate(), Start(), etc. - and explained to us what each function did and when they would be best to be implemented or used.
| void Awake() and void Start() |
Along with scripting functions, our lecturer also covered velocity and a more realistic control or mechanic for the actual jetpack with a function called Rb.AddForce. To access the function .AddForce, first we need to access the game object's rigidbody component, and that can be done by the function [Name of variable here] = GetComponent<Rigidbody>() or a public Rigidbody [Name of variable] here.
| Code for the jetpack controls |
MILESTONES & ACHIEVEMENTS:
From last week, I managed to put in whatever we went through on our last lecture, into simple practices with small pieces of code and other modules which require codes, such as GAM112. I found that this module helps out a lot with other modules as I learn new things and functions that can be used to add on more mechanics on future projects. For this week's milestone, and possibly the few weeks after the next, I would be working on the first assignment, allowing me to evaluate my work faster and learn where I went wrong.
No comments:
Post a Comment