-
Notifications
You must be signed in to change notification settings - Fork 26
Week 3 Content #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Week 3 Content #95
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6905b0e
Update script.md
ColeHorvat 7467607
Update ReadMe.md
ColeHorvat 1d990e6
Rename ReadMe.md to homework.md
ColeHorvat bd6824a
Update temp.md
ColeHorvat 92bae29
Update and rename GameDev/week3/homework/issues/starter/temp.md to Ga…
ColeHorvat d82dcb1
Update and rename temp.md to solutions.md
ColeHorvat f0cb9cf
Added syntax colouring
ColeHorvat 55bf919
Rename starter.md to starter.cs
ColeHorvat 04ae321
Update starter.cs
ColeHorvat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Week 3 Homework | ||
| - Create a boost function that doubles the speed of the car if you're holding the Space key. | ||
|
|
||
| - Create an original game using the design document template we've provided. | ||
|
|
||
| - Create a project for the game you create in the design document and try to find and import assets that you could use. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| using System.Collections; | ||
| using System.Collections.Generic; | ||
| using UnityEngine; | ||
|
|
||
| public class PlayerController : MonoBehaviour | ||
| { | ||
| //Variables | ||
| public float speed = 15.0f; | ||
| private float turnSpeed = 25.0f; | ||
| private float horizontalInput; | ||
| private float forwardInput; | ||
|
|
||
| // Start is called before the first frame update | ||
| void Start() | ||
| { | ||
|
|
||
| } | ||
|
|
||
| // Update is called once per frame | ||
| void Update() | ||
| { | ||
| horizontalInput = Input.GetAxis("Horizontal"); | ||
| forwardInput = Input.GetAxis("Vertical"); | ||
|
|
||
| // We move the vehicle forward | ||
| transform.Translate(Vector3.forward * Time.deltaTime * speed * forwardInput); | ||
|
|
||
| //We turn the vehicle | ||
| transform.Rotate(Vector3.up, Time.deltaTime * turnSpeed * horizontalInput); | ||
| } | ||
| } |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| # Assignment 1: Car Boost | ||
|
|
||
| ## Solution 1: | ||
|
|
||
|
|
||
| using System.Collections; | ||
| using System.Collections.Generic; | ||
| using UnityEngine; | ||
|
|
||
| public class PlayerController : MonoBehaviour | ||
| { | ||
| //Variables | ||
| public float speed = 15.0f; | ||
| private float turnSpeed = 25.0f; | ||
| private float horizontalInput; | ||
| private float forwardInput; | ||
| private float boostInput; | ||
| private float boost; | ||
|
|
||
|
|
||
| // Start is called before the first frame update | ||
| void Start() | ||
| { | ||
|
|
||
| } | ||
|
|
||
| // Update is called once per frame | ||
| void Update() | ||
| { | ||
| boost = 1.0f; | ||
| horizontalInput = Input.GetAxis("Horizontal"); | ||
| forwardInput = Input.GetAxis("Vertical"); | ||
| boostInput = Input.GetAxis("Jump"); | ||
|
|
||
| boost += boostInput; | ||
|
|
||
| // We move the vehicle forward | ||
| transform.Translate(Vector3.forward * Time.deltaTime * speed * forwardInput * boost); | ||
|
|
||
| //We turn the vehicle | ||
| transform.Rotate(Vector3.up, Time.deltaTime * turnSpeed * horizontalInput); | ||
| } | ||
| } | ||
|
|
||
| ## Solution 2: | ||
|
|
||
|
|
||
| using System.Collections; | ||
| using System.Collections.Generic; | ||
| using UnityEngine; | ||
|
|
||
| public class PlayerController : MonoBehaviour | ||
| { | ||
| //Variables | ||
| public float speed = 15.0f; | ||
| private float turnSpeed = 25.0f; | ||
| private float horizontalInput; | ||
| private float forwardInput; | ||
| private float boostInput; | ||
| private float boost = 2.0f; | ||
|
|
||
|
|
||
| // Start is called before the first frame update | ||
| void Start() | ||
| { | ||
|
|
||
| } | ||
|
|
||
| // Update is called once per frame | ||
| void Update() | ||
| { | ||
| horizontalInput = Input.GetAxis("Horizontal"); | ||
| forwardInput = Input.GetAxis("Vertical"); | ||
| boostInput = Input.GetAxis("Jump"); | ||
|
|
||
| // We move the vehicle forward | ||
| if(boostInput > 0f) | ||
| transform.Translate(Vector3.forward * Time.deltaTime * speed * forwardInput * boost); | ||
| else | ||
| transform.Translate(Vector3.forward * Time.deltaTime * speed * forwardInput); | ||
|
|
||
| //We turn the vehicle | ||
| transform.Rotate(Vector3.up, Time.deltaTime * turnSpeed * horizontalInput); | ||
| } | ||
| } | ||
|
|
||
| # Assignment 2: Project Design Document | ||
|
|
||
| Given the nature of the assignment, there is no set solution. The assignment only needs an original game planned out in the project design document template we provide. | ||
|
|
||
| # Assignment 3: Importing Assets | ||
|
|
||
| Like the second assignment, there is no set solution. The assignment only needs a Unity project that has assets in it that could be used to develop the game that the students planned in assignment 2. | ||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.