Skip to content

Instantly share code, notes, and snippets.

View curious-username's full-sized avatar

Ben-Jammin curious-username

View GitHub Profile
@curious-username
curious-username / EnemyMissileMovement1.cs
Last active December 1, 2021 04:37
EnemyMissileMovement1
void Start()
{
_playerLocation = GameObject.Find("Player");
if(_playerLocation == null)
{
Debug.Log("Player not found");
}
}
@curious-username
curious-username / EnemyMissleVariables.cs
Last active December 1, 2021 04:27
Implementation of enemy missile
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemyMissle : MonoBehaviour
{
private GameObject _playerLocation;
[SerializeField]
private GameObject _explosion;
@curious-username
curious-username / EnemyMisslePlanning
Last active November 23, 2021 04:15
planning missile for the enemy object
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 November 18, 2021 02:03
camera shake when player takes damage
private CameraShake _playerShake;
void Start()
{
_playerShake = GameObject.Find("Camera").GetComponent<CameraShake>();
}
public void Damage()
{
@curious-username
curious-username / camerashake.cs
Created November 18, 2021 01:20
camerashake script
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;
@curious-username
curious-username / slowdown.cs
Last active November 17, 2021 02:43
slow down effect
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 November 17, 2021 02:35
slowdown implimentation
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 November 17, 2021 02:04
power up modification
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 / slowdown.txt
Created November 16, 2021 04:15
planning it out
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 November 5, 2021 19:47
Spawnmanager changes for big laser
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SpawnManager : MonoBehaviour
{
[SerializeField]
private int _bigLaserCount;
private float _randomNumber;