This file contains 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
public float speed = 5.0f; // Global variable | |
float horizontalInput = Input.GetAxis("Horizontal"); | |
float verticalInput = Input.GetAxis("Vertical"); | |
transform.Translate(Vector3.right * horizontalInput * speed * Time.deltaTime); | |
transform.Translate(Vector3.up * verticalInput * speed * Time.deltaTime); |
This file contains 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
void Update() | |
{ | |
PlayerMovement(); | |
} | |
void PlayerMovement() | |
{ | |
float horizontalInput = Input.GetAxis("Horizontal"); | |
float verticalInput = Input.GetAxis("Vertical"); |
This file contains 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
if (transform.position.y > 5.7f) | |
{ | |
transform.position = new Vector3(transform.position.x, 5.7f, 0); | |
} | |
else if (transform.position.y < -5.7f) | |
{ | |
transform.position = new Vector3(transform.position.x, -5.7f, 0); | |
} | |
else if (transform.position.x > 11.35f) |
This file contains 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
import os | |
os.listdir() | |
os.mkdir('Sample') | |
os.listdir() |
This file contains 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
import os | |
os.listdir() | |
os.mkdir('Seahorse') | |
os.listdir() |
This file contains 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
import os | |
directory = input() | |
print(os.listdir()) | |
os.mkdir(directory) | |
print(os.listdir()) | |
This file contains 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
import os | |
while True: | |
directory = input('Enter a folder name to create\n') | |
if directory == '': | |
break | |
else: | |
print(os.listdir()) | |
os.mkdir(directory) | |
print(os.listdir()) |
This file contains 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
void CalculateMovement() | |
{ | |
transform.Translate(Vector3.up * _speed * Time.deltaTime); | |
if (transform.position.y > 7.0f) | |
{ | |
if(transform.parent != null) | |
{ | |
Destroy(this.gameObject); | |
} | |
Destroy(this.gameObject); |
This file contains 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
void FireLaser() | |
{ | |
Vector3 offset = new Vector3(0, -0.86f, 0); | |
Instantiate(_laser, offset, Quaternion.identity); | |
} |
This file contains 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
[SerializeField] | |
private Text _gameOverText; | |
public void GameOver() | |
{ | |
_gameOverText.gameObject.SetActive(true); | |
_scoreText.gameObject.SetActive(false); | |
_gameOverText.text = "Game Over!"; | |
} |
OlderNewer