Build & Play

Road Hazard

Share this...
Share on FacebookShare on Google+Tweet about this on TwitterEmail this to someone
Please wait...

 

The Munky Says

.Game Description

Another simple HTML5 game designed to dodge road hazards to rack up points.

.Controls

Arrow Keys to dodge the road hazards. Press ‘R’ to restart the game.

.Dev Comments

Developed this game using the same coding/tutorial discussed in Unity’s ‘Space Shooter’ tutorial. The game play is horrendous and after about the second wave of road hazards I am ready to move on with life. However, this was an attempt to see if I could play around with the coding and try to apply the concepts from the first Unity tutorial (baby steps). Unity’s asset store has a ton of free assets you can download to make this happen. I found a modern red sports car for my “player” and started to find assets as I went along with the coding (e.g. bgm, background…).

I did have to pick and choose some of the coding because in this game the coding from the space shooter tutorial did not apply such as tilt (which I could have used but decided not to) and laser beams (although a car with laser beams would be pretty damn cool). In addition, I had to slightly change the coding to reflect the “Add Scores” section as we no longer have laser beams. I changed it so that if the hazard (in the space shooter case the Asteroid) collided with the boundary, a score would be added (see c1.1 below). This may not necessarily be the best way to do this but once again – I have no knowledge of C# or coding in general prior to two days ago. This sort of works but the scoring is delayed.

c1.1

void OnTriggerEnter(Collider other)
{
if (other.tag == “Boundary”)
{
gameController.AddScore(scoreValue);
return;
}
Instantiate(explosion, transform.position, transform.rotation);
if (other.tag == “Player”)
{
Instantiate(playerExplosion, other.transform.position, other.transform.rotation);
gameController.GameOver();
}
Destroy(other.gameObject);
Destroy(gameObject);
}

As I learn a bit more about Unity I would like to add:

  • High scores leaderboard
  • High scores that can be submitted to a PHP database
  • Ability to choose your car (found some pretty cool sports car models for free on Unity)
  • Different Hazard types
  • Levels – maybe increase the scroll speed and spawn count?


2 thoughts on “Road Hazard”

Leave a Reply

Your email address will not be published. Required fields are marked *


Skip to toolbar