Today we dressed the simple 3d assets with some borrowed 2d sprite assets. And might I say it’s looking good. So good in fact that a 1.0 web release is ready!

Skinning

At the time of creation our game was created with 3D assets, however moving forward the plan is for my first game to be 2D so start early? Here is what we had to do in order to convert everything from 3D assets to 2D.

  1. Import your sprites into the project view.
  2. Delete all rigid body, box colliders, and mesh renders that exist on your 3D objects.
  3. Now add 2D rigid body, and 2D box collider to the appropriate elements.
  4. Next add a Sprit render to your objects, and drag your sprite from your project folder into the Sprite field of your Sprit render.
  5. That’s it.

Well almost if you are converting from 3D objects to 2D objects you’ll need to update your trigger detection code to use 2D functions.

Go from this.

private void OnTriggerEnter(Collider other) {

		if (other.tag == "Player"){

			Player player = other.transform.GetComponent<Player>();

			if (player != null) {
				player.Damage();
			}

			Destroy(this.gameObject);

		}

		if (other.tag == "Laser") {
			Destroy(other.gameObject);
			Destroy(this.gameObject);
		}
	}

To this.

private void OnTriggerEnter2D(Collider2D other) {

		if (other.tag == "Player"){

			Player player = other.transform.GetComponent<Player>();

			if (player != null) {
				player.Damage();
			}

			Destroy(this.gameObject);

		}

		if (other.tag == "Laser") {
			Destroy(other.gameObject);
			Destroy(this.gameObject);
		}
	}

Deploying to the Web

Now that an early alpha of the game is working. Where you can shoot enemies, and have three lives it’s time to WOW the world. Fortunately, to make a web video game with Unityall we simply have to do is the following.

  1. File > Build Settings…
  2. Choose WebGL
  3. (Optional) You may then on the WebGL screen have to press switch platform.
  4. Click Build and choose your build destination.
  5. From your build, you’ll have a index.html with other asset folders. Simply upload them to your chosen web server and enjoy it!
Folder hosted on my domain thriftydeveloper.com
WebGL view at thriftydeveloper.com/exodusflight/1.0

Note: If you die simply refresh the window. Respawning and UI coming in next week’s release.