Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Ben-Jammin curious-username

🎯
Focusing
View GitHub Profile
@curious-username
curious-username / EnemyMisslePlanning
Last active Nov 23, 2021
planning missile for the enemy object
View EnemyMisslePlanning
CREATE A HEAT-SEEKING MISSLE
GRAPHICS
---------
SMALL RED MISSLE
RESIZED TO ENEMY AND PLAYER TRANSFORM.SCALE
VFX
---------
EXPLOSION ON COLLIDER CONTACT
@curious-username
curious-username / player.cs
Last active Nov 18, 2021
camera shake when player takes damage
View player.cs
private CameraShake _playerShake;
void Start()
{
_playerShake = GameObject.Find("Camera").GetComponent<CameraShake>();
}
public void Damage()
{
View camerashake.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraShake : MonoBehaviour
{
[SerializeField]
private Camera _mainCam;
private bool _cameraShakeEnabled;
private float _shakeAmount = 0.01f;
View slowdown.cs
IEnumerator SpawnPowerupRoutine()
{
//every 3 - 7 seconds, spawn in a powerup
while (_stopSpawning == false)
{
float _randomSpawnPosition = Random.Range(-9.0f, 9.0f);
Vector3 spawn = new Vector3(_randomSpawnPosition, 7, 0);
_randomPowerup = Random.Range(0, 7);
if (_bigLaserCount == 5)
@curious-username
curious-username / slowdown.cs
Last active Nov 17, 2021
slowdown implimentation
View slowdown.cs
private bool _isSlowDownActive = false;
[SerializeField]
private GameObject _slowDown;
[SerializeField]
AudioSource _slowDownSound;
private WaitForSeconds _fiveSecondsYieldTime = new WaitForSeconds(5.0f);
private WaitForSeconds _twoSecondsYieldTime = new WaitForSeconds(2.0f);
void CalculateMovement()
{
@curious-username
curious-username / powerup.cs
Created Nov 17, 2021
power up modification
View powerup.cs
private void OnTriggerEnter2D(Collider2D other)
{
if (other.tag == "Player")
{
Player player = other.GetComponent<Player>();
if (player != null)
{
//if powerUp ID is 0
View slowdown.txt
Player Slowdown Pickup
----------------------
Pickup
------
sphere object from unity
create a pink'ish material
needs 2d collider and 2d rigidbody, remove sphere collider
need to be added to the spawn manager
though not a powerup, will be treated as one, added it to powerup script
@curious-username
curious-username / spawnmanager.cs
Last active Nov 5, 2021
Spawnmanager changes for big laser
View spawnmanager.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SpawnManager : MonoBehaviour
{
[SerializeField]
private int _bigLaserCount;
private float _randomNumber;
View powerup.cs
private void OnTriggerEnter2D(Collider2D other)
{
if (other.tag == "Player")
{
Player player = other.GetComponent<Player>();
if (player != null)
{
//if powerUp ID is 0
@curious-username
curious-username / Player.cs
Created Nov 5, 2021
big laser changes to player
View Player.cs
public class Player : MonoBehaviour
{
[SerializeField]
private GameObject _bigLaser, _laserCharge;
private bool _isBigLaserActive = false;
[SerializedField]
AudioSource _chargingSound, _bigLaserSound;
void FireLaser()