Overview
A 2D space shooter in which the player controls a mining ship and uses a mining laser to extract valuable ores from asteroids. The player must fight off swarms of alien spaceships while securing as much payload as they can.
Duration: Feb 2020 - June 2020
Team Size: Solo
Roles: Design • Code • Art • Sound
Engine: Unity
Technologies: C#
Platforms: Windows
Contributions
• Deployed resolution scaling methods to create a crisp pixel-art look using both 2D and 3D Game Assets.
• Implemented AI steering behaviors to make enemies realistically target the player.
• Implemented dynamic, stylized lighting to 3D objects using Unity ShaderLab and HLSL.
• Implemented and optimized item and projectile spawns using object pooling.
• Deployed Git Version Control System to track and manage changes to project code.

Mining Asteroids

To create the mining effect I used Unity's line renderer for the laser, and object pooling to spawn dust and flame particle effects. Below is the function which controls the rendering of the laser, the spawning of particles, and appling damage to the asteroid.

C#
				
					public void UpdateMiningLaser(bool keypressed, Vector3 mousepos, Vector3 playerpos)
					{
						laser1LineRenderer.enabled = false;
						laser2LineRenderer.enabled = false;
					
						if (keypressed == false)
						return;
						
						RaycastHit2D hit1 = Physics2D.Raycast(	gun1.transform.position,
																		(transform.position + (mousepos - playerpos) * 0.5f) - gun1.transform.position,
																		25.0f,
																		1 << LayerMask.NameToLayer("Asteroids")); 
						RaycastHit2D hit2 = Physics2D.Raycast(	gun2.transform.position,
																		(transform.position + (mousepos - playerpos) * 0.5f) - gun2.transform.position, 
																		25.0f, 
																		1 << LayerMask.NameToLayer("Asteroids")); 
						if (hit1.collider !=null) 
							LaserHit(gun1.transform.position, hit1, ref laser1LineRenderer); 
						if (hit2.collider !=null) 
							LaserHit(gun2.transform.position, hit2, ref laser2LineRenderer); 
							
						void LaserHit(Vector3 origin, RaycastHit2D hit, ref LineRenderer laserLineRenderer) 
						{ 
							if (hit.collider.CompareTag("Asteroid")==false) 
								return;
								
							laserLineRenderer.enabled=true;
							laserLineRenderer.positionCount=2; 
							laserLineRenderer.SetPosition(0, origin); 
							laserLineRenderer.SetPosition(1,hit.point); 
							
							ParticleEffects.Instance.SpawnParticles(hit.point, 1, ParticleType.dust);
							ParticleEffects.Instance.SpawnParticles(hit.point, 1, ParticleType.fire); 
							
							Asteroid asteroid = hit.collider.GetComponentInParent<Asteroid>();
							asteroid.Melt(0.2f);
						}
					}
				
			
player mining an asteroid in game
A player mining an asteroid

Mining Asteroids

To create the mining effect I used Unity's line renderer for the laser and object pooling to spawn dust and flame particle effects. Below is the function which controls the rendering of the laser, the spawning of particles, and appling damage to the asteroid.

html
					
						public void DoMiningLaser(bool keypressed, Vector3 mousepos, Vector3 playerpos)
						{
							laser1LineRenderer.enabled = false;
							laser2LineRenderer.enabled = false;
						
							if (keypressed == false)
							return;
							
							RaycastHit2D hit1 = Physics2D.Raycast(	gun1.transform.position,
																			(transform.position + (mousepos - playerpos) * 0.5f) - gun1.transform.position,
																			25.0f,
																			1 << LayerMask.NameToLayer("Asteroids")); 
							RaycastHit2D hit2 = Physics2D.Raycast(	gun2.transform.position,
																			(transform.position + (mousepos - playerpos) * 0.5f) - gun2.transform.position, 
																			25.0f, 
																			1 << LayerMask.NameToLayer("Asteroids")); 
							if (hit1.collider !=null) 
								LaserHit(gun1.transform.position, hit1, ref laser1LineRenderer); 
							if (hit2.collider !=null) 
								LaserHit(gun2.transform.position, hit2, ref laser2LineRenderer); 
								
							void LaserHit(Vector3 origin, RaycastHit2D hit, ref LineRenderer laserLineRenderer) 
							{ 
								if (hit.collider.CompareTag("Asteroid")==false) 
									return;
									
								laserLineRenderer.enabled=true;
								laserLineRenderer.positionCount=2; 
								laserLineRenderer.SetPosition(0, origin); 
								laserLineRenderer.SetPosition(1,hit.point); 
								
								ParticleEffects.Instance.SpawnParticles(hit.point, 1, ParticleType.dust);
								ParticleEffects.Instance.SpawnParticles(hit.point, 1, ParticleType.fire); 
								
								Asteroid asteroid = hit.collider.GetComponentInParent<Asteroid>();
								asteroid.Melt(0.2f);
							}
						}
					
				
this slowpoke moves
An image of a thing