Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Ben-Jammin curious-username

🎯
Focusing
View GitHub Profile
@curious-username
curious-username / border_limits.cs
Last active Sep 7, 2021
Unity Example of border limits
View border_limits.cs
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)
@curious-username
curious-username / player_control.cs
Created Sep 7, 2021
showing example of player control in Unity
View player_control.cs
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);
@curious-username
curious-username / playerMovement.cs
Last active Sep 7, 2021
moving all player movement into a single method
View playerMovement.cs
void Update()
{
PlayerMovement();
}
void PlayerMovement()
{
float horizontalInput = Input.GetAxis("Horizontal");
float verticalInput = Input.GetAxis("Vertical");
View folder_creation.py
import os
os.listdir()
os.mkdir('Sample')
os.listdir()
View folder_creation2.py
import os
os.listdir()
os.mkdir('Seahorse')
os.listdir()
@curious-username
curious-username / folder_creation_function.py
Last active Sep 11, 2021
basic folder creation function
View folder_creation_function.py
import os
directory = input()
print(os.listdir())
os.mkdir(directory)
print(os.listdir())
@curious-username
curious-username / folder_loop.py
Created Sep 11, 2021
recursively creating a folder
View folder_loop.py
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())
View laser.cs
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);
View firelaser_method.cs
void FireLaser()
{
Vector3 offset = new Vector3(0, -0.86f, 0);
Instantiate(_laser, offset, Quaternion.identity);
}
@curious-username
curious-username / pre_gameover_txt.cs
Last active Sep 16, 2021
pre gameover text, pre null
View pre_gameover_txt.cs
[SerializeField]
private Text _gameOverText;
public void GameOver()
{
_gameOverText.gameObject.SetActive(true);
_scoreText.gameObject.SetActive(false);
_gameOverText.text = "Game Over!";
}