UNIVERSITY OF MUMBAI                                            Roll-No:53
A PROJECT REPORT ON
                              “STREET RACER”
                                SUBMITTED BY
                               MANASI JAGADE
                                 GUIDED BY
                               Prof. Sandeep.P
                       DEPARTMENT OF COMPUTER SCIENCE
              NES RATNAM COLLEGE OF SCIENCE,COMMERCE AND ARTS
                                                                             1
                                    YEAR 2019-2020
                 NES RATNAM COLLEGE OF SCIENCE,COMMERCE AND ARTS
                       DEPARTMENT OF COMPUTER SCIENCE
                              UNIVERSITY OF MUMBAI
                                      CERTIFICATE
This is to certify that the project titled “STRRET RACER” has been successfully completed
under our supervision and guidance, by the following student:
                                    MANASI JAGADE
In the partial fulfilment of semester V in computer science branch as prescribed by the
University of Mumbai during the academic year 2019-2020. The said work has been
assessed and is found to be satisfactory.
  Prof. ________________                                         Prof. ________________
      (Internal Guide)                                              (External Examiner)
________________________                                           ___________________
       College Seal                                                (Head of Department)
                                            (Principal Sign)
                                                                                            2
INDEX
        3
SR.NO   NAME OF TOPIC               PAGE.NO
1       Acknowledgement             6
2       Abstract                    8
3       Introduction                10
4       Purpose                     12
5       Requirement Specification   14
6       Description                 16
7       Flowchart                   21
8       Gantt chart                 24
9       Use-Case Diagram            26
10      ER-Diagram                  28
11      Source Code                 30
12      Testing                     38
13      Screenshots                 42
14      Conclusions                 48
15      Future Scope                50
16      Webliography                51
                                              4
            DECLARATION
 I MANASI.M.JAGADE, student of T.Y B.C.S of N.E.S RATNAM
COLLEGE OF ARTS, SCIENCE & COMMERCE BHANDUP (W)
MUMBAI-400078,hereby declare that I have completed my project
on “STREET RACER” for the ACADEMIC YEAR : 2019. The
information given in this project is true and original to the best of my
knowledge.
DATE : _____________
PLACE : MUMBAI
                                          ____________________
                                              SIGNATURE
                                                                           5
ACKNOWLEDGEMENT
                  6
I have great pleasure for representing this project report & title “” & I
grabbed this opportunity to convey my immense regards towards all
the distinguish people who have the valuable contribution in the hour
of need.
 I would like to thank “Dr. Mary Vimochana” our Principle of “NES
Ratnam College, Bhandup (West)” for giving me an opportunity to
study in this institute & the most needed guidance throughout the
duration of the course.
I would also like to extend my gratitude to “Mrs. Vinita Dhulia”
Head of the Department for her timely & prestigious guidance.
 My heartfelt gratitude to my project guide “Mr .Sandeep Pathak”, for
his valuable suggestions and guidance in the preparation of the project
report.
I will be failing in duty if I do not acknowledge with grateful thanks
to the authors of the references and other literatures referred to in this
seminar.
 I also owe to my fellow friends who have been constant source of
help to solve the errors.
                                                                             7
ABSTRACT
           8
This bachelor thesis describes a case study, where we are focusing on
developing a 2D racing our game, using a process based upon agile
development; an evolutionary development method .
The thesis will cover implementation of real-time graphics, physics
engine as well as sound effects and background music.
In the end, our case study will show that this development process
was an appropriate choice for our game development project.
                                                                        9
INTRODUCTION
               10
Unity is a cross-platform game engine developed by Unity
Technologies, first announced and released in June 2005 at Apple
Inc.'s Worldwide Developers Conference as a Mac OS X-exclusive
game engine. As of 2018, the engine had been extended to support
more than 25 platforms. is the ultimate game development platform.
The engine can be used to create high-quality three-dimensional
, two-dimensional, virtual reality, and augmented reality games,
deploy them across mobile, desktop, as well as simulations and other
experiences. The engine has been adopted by industries outside video
gaming,suchas film, automotive, architecture, engineering and constru
ction . Several major versions of Unity have been released since its
launch. The latest stable version, 2019.2.4, was released in September
2019. It is a cross-platform game engine. which is primarily used
to develop video games and simulations for computers, consoles and
mobile devices.
                                                                         11
PURPOSE
          12
1. Stress reduction.
2. Information gathering.
3. Concentration and focus.
4. Memory.
5. Decision making.
6. Strategy and problem solving.
7. Coordination.
8. Longterm wellbeing.
                                   13
Requirement Specification
                            14
A software requirements specification (SRS) is a document that
captures complete description about how the system is expected to
perform. It is usually signed off at the end of requirements
engineering phase.
Hardware Requirement:
Processor :    Intel core Duo 2.0 Ghz or more.
Ram       :    512 MB or more.
Memory :       10GB or more.
Monitor :      15” CRT or LCD monitor.
Keyboard :     Normal or Multimedia.
Mouse     :    Compatible mouse.
Software Requirement:
  1. Unity3D Game Engine
  2. VisualStudio for C# scripting
  3. Windows OS .
  4. Inkscape
                                                                    15
DESCRIPTION
              16
Unity is a cross-platform game engine developed by Unity
Technologies. Unity can be used to develop not only games but also
used to build high-quality 3D and 2D games, deploy them across
mobile, desktop, VR/AR, console. It is a never ending game .There is
one track having three lanes moving left or right using the keyboard
that are used in game window. Various car will be randomly coming
from top.
The task is to score maximum points by moving left or right without
colliding enemy car. If the player/truck collides with the enemy car
the game will be over. You can pause the game by pressing pause
button which is displayed in the right corner of the game window.
If the game gets over there will be panel displaying score which is
scored by the player/truck and three buttons Replay , Menu and Exit.
By clicking replay button it will restart the game. Menu will take you
to the start panel where you can click play and the game will be
started. Exit will quit the game.Various Window is there for game
like Pause, Playing ,Menu Window etc. Game has a feature of sound
effects when the player or car is moving.
                                                                         17
INSPECTOR WINDOW
Games in Unity are made up of multiple GameObjects that contain
meshes, scripts, sounds, or other graphical elements like Lights.
The Inspector displays detailed information about your currently
selected Game Object, including all attached Components and their
properties.
COLLIDER
Collider components define the shape of an object for the purposes of
physical collisions. A collider, which is invisible, need not be the
exact same shape as the object’s mesh and in fact, a rough
approximation is often more efficient and indistinguishable in
gameplay.
The simplest (and least processor-intensive) colliders are the so-
called primitive collider types. In 3D, these are the Box Collider
,Sphere Collider and Capsule Collider. In 2D, you can use the Box
Collide2D and Circle Collider 2D. Any number of these can be added
to a single object to create compound colliders.
Transform
Every object In a Scene has a Transform. It's used to store and
manipulate the position, rotation and scale of the object. Every
Transform can have a parent, which allows you to apply position,
rotation and scale hierarchically. Position will change the position of a
object. Rotation will rotate the object. Scaling will shrink or enlarge
the player.
                                                                            18
C# Scripting
The behaviour of Game Objects is controlled by the components that
are attached to them. Although Unity’s built-in Components can be
very versatile, you will soon find you need to go beyond what they
can provide to implement your own gameplay features. Unity allows
you to create your own Components using scripts. These allow you to
trigger game events, modify Component properties over time and
respond to user input in any way you like.
Unity supports the C# programming language natively. C#
(pronounced C-sharp) is an industry-standard language similar to Java
or C++.
 Unlike most other assets, scripts are usually created within Unity
directly. You can create a new script from the Create menu at the top
left of the Project panel or by selecting Assets > Create > C#
Script from the main menu.
The new script will be created in whichever folder you have selected
in the Project panel. The new script file’s name will be selected,
prompting you to enter a new name.
                                                                        19
INKSCAPE
Inkscape is a free and open-source vector graphics editor. This
software can be used to create or edit vector graphics such as
illustrations, diagrams, line arts, charts, logos and complex paintings.
Inkscape's primary vector graphics format is Scalable Vector
Graphics (SVG); however, many other formats can be imported and
exported.
Inkscape can render primitive vector shapes (e.g. rectangles, ellipses,
polygons, arcs, spirals, stars and 3D boxes) and text. These objects
may be filled with solid colours , patterns, radial or linear colour
gradients and their borders may be stroked, both with adjustable
transparency. Embedding and optional tracing of raster graphics is
also supported, enabling the editor to create vector graphics from
photos and other raster sources. Created shapes can be further
manipulated with transformations, such as moving, rotating, scaling
and skewing.
                                                                           20
FLOWCHART
            21
 Flowchart is a formalized graphic representation of a logic sequence,
work or manufacturing process, organization chart, or similar
formalized structure. The purpose of a flow chart is to provide people
with a common language or reference point when dealing with a
project or process.
Flowcharts use simple geometric symbols and arrows to define
relationships. In programming, for instance, the beginning or end of a
program is represented by an oval. A process is represented by a
rectangle, a decision is represented by a diamond and an I/O process
is represented by a parallelogram. The Internet is represented by a
cloud.
                                                                         22
23
Gantt Chart
              24
25
USE-CASE DIAGRAM
                   26
27
ER-DIAGRAM
             28
29
SourceCode
             30
CarController.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CarController : MonoBehaviour
{
  public float carSpeed;
  public float maxPos = 2.2f;
  Vector3 position;
  public uiManager ui;
  public AudioManager am;
  // Start is called before the first frame update
  void Start()
  {
     am.carSound.Play();
     position = transform.position;
  }
  // Update is called once per frame
  void Update()
  {
     position.x+= Input.GetAxis("Horizontal") * carSpeed *
Time.deltaTime;
     position.x=Mathf.Clamp(position.x, -2.2f,2.2f);
     transform.position = position;
  }
  void OnCollisionEnter2D(Collision2D collision)
  {
    if(collision.gameObject.tag=="e1")
    {
       Destroy(gameObject);
       ui.gameOverActivated();
       am.carSound.Stop();
                                                             31
        }
    }
}
CarSpawner.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CarSpawner : MonoBehaviour
{
  public GameObject[] cars;
  int carNo;
  public float maxPos=2.2f;
  public float delayTimer=1f;
  float timer;
  // Start is called before the first frame update
  void Start()
  {
     timer = delayTimer;
  }
   // Update is called once per frame
   void Update()
   {
      timer -= Time.deltaTime;
      if (timer <= 0)
      {
         Vector3 carPos = new Vector3(Random.Range(-2.2f, 2.2f),
transform.position.y, transform.position.z);
         carNo = Random.Range(0, 5);
         Instantiate(cars[carNo], carPos, transform.rotation);
         timer = delayTimer;
      }
   }
}
                                                                   32
EnemyCarMove.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemyCarMove : MonoBehaviour
{
  public float speed = 8f;
  // Update is called once per frame
  void Update()
  {
     transform.Translate(new Vector3(0, 1, 0)*
speed*Time.deltaTime);
  }
}
EnemyDestroyer.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemyDestroyer : MonoBehaviour
{
  void OnCollisionEnter2D(Collision2D collision)
  {
     if (collision.gameObject.tag == "e1")
     {
        Destroy(collision.gameObject);
     }
  }
}
                                                   33
uimanager.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class uiManager : MonoBehaviour
{
  public Button[] buttons;
  public Text scoreText;
  bool gameOver;
  int score;
  private void Start()
  {
     gameOver = false;
     score = 0;
     InvokeRepeating("scoreUpdate", 1.0f, 0.5f);
  }
  private void Update()
  {
     scoreText.text = "Score:" + score;
  }
  void scoreUpdate()
  {
     if (gameOver == false)
     {
        score += 1;
     }
  }
  public void gameOverActivated()
  {
     gameOver = true;
     foreach(Button button in buttons)
     {
        button.gameObject.SetActive(true);
     }
                                                   34
    }
    [System.Obsolete]
    public void Play()
    {
      Application.LoadLevel("level1");
    }
    public void Pause()
    {
      if (Time.timeScale == 1) {
         Time.timeScale = 0;
      }
      else if (Time.timeScale == 0) {
         Time.timeScale = 1;
      }
    }
    public void Replay()
    {
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
  }
  public void Menu()
  {
    SceneManager.LoadScene("menu");
    }
    public void Exit()
    {
      Application.Quit();
    }
                                                              35
AudioManager.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AudioManager : MonoBehaviour
{
  public AudioSource carSound;
}
SceneSwitch.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SceneSwitch : MonoBehaviour
{
  public void changemenuscene(string scenename)
  {
     Application.LoadLevel (scenename);
  }
                                                  36
TrackMove.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TrackMove : MonoBehaviour
{
  public float speed;
  Vector2 offset;
  // Update is called once per frame
  void Update()
  {
     offset = new Vector2(0, Time.time * speed);
     GetComponent<Renderer>().material.mainTextureOffset =
offset;
  }
}
                                                             37
TESTING
          38
Software testing is a process, to evaluate the functionality of a
software application with an intent to find whether the developed
software met the specified requirements or not and to identify the
defects to ensure that the product is defect free in order to produce the
quality product.
A test approach is the test strategy implementation of a project,
defines how testing would be carried out. Test approach has two
techniques:
• Proactive - An approach in which the test design process is initiated
as early as possible in order to find and fix the defects before the build
is created.
 • Reactive - An approach in which the testing is not started until after
design and coding are completed.
Type of Testing:
What is White Box Testing?
White Box Testing is defined as the testing of a software solution's
internal structure, design, and coding. In this type of testing, the code
is visible to the tester. It focuses primarily on verifying the flow of
inputs and outputs through the application, improving design and
usability, strengthening security. White box testing is also known as
Clear Box testing, Open Box testing, Structural testing, Transparent
Box testing, Code-Based testing, and Glass Box testing. It is usually
performed by developers.
What do you verify in White Box Testing?
White box testing involves the testing of the software code for the
following:
• Internal security holes.
• Broken or poorly structured paths in the coding processes.
• The flow of specific inputs through the code.
• Expected output.
                                                                             39
• The functionality of conditional loops.
• Testing of each statement, object, and function on an individual
basis.
What is Black Box Testing?
Black box testing is defined as a testing technique in which
functionality of the Application Under Test (AUT) is tested without
looking at the internal code structure, implementation details and
knowledge of internal paths of the software. This type of testing is
based entirely on software requirements and specifications.
Types of Black Box Testing
 There are many types of Black Box Testing but the following are the
prominent ones –
 • Functional testing - This black box testing type is related to the
functional requirements of a system; it is done by software testers.
 • Non-functional testing - This type of black box testing is not related
to testing of specific functionality, but non-functional requirements
such as performance, scalability, usability.
 • Regression testing - Regression Testing is done after code fixes,
upgrades or any other system maintenance to check the new code has
not affected the existing code.
                                                                            40
TESTING IMPLEMENTATION IN GAMES
Black Box Testing: Black Box concentrates on the functionality or
playability of a game. The user interface will be tested, as in how the
menus work and the functions of the various buttons.The look and
feel of the game as well as the actual gameplay are also tested in
black box testing techniques.Testers will have to comment of the
graphics and animations. A black box tester will need to know how to
play the game, how the game pad works, how the game flows and the
rules.
White Box Testing: White Box Testing techniques concentrate of
the build and combining aspects of the game. For example, how the
database is used, and how the different components of the game
interact and integrate with each other.A clear box tester will need to
know about coding. Software testers also have a vital part to play.
                                                                          41
SCREENSHOTS
              42
WHEN WE CLICK ON PLAY FROM UNITY WINDOW THIS
SCENE WILL BE DISPLAYED.
                                               43
WHEN WE CLICK ON PLAY FROM GAME WINDOW THE
GAME WILL BE STARTED.
                                             44
45
IF THE PLAYER COLLIDES WITH THE ENEMY CAR THIS
PANEL WILL BE DISPLAYED.
                                                 46
IF WE CLICK ON PAUSE BUTTON
IF WE CLICK ON RAPLAY THE GAME WILL RESTART
AGAIN.
IF WE CLICK ON MENU BUTTON IT WILL TAKE TO THE
MENU WINDOW
                                                 47
CONCLUSION
             48
Thinking of the game as a part of a bigger educational process
is really in the core mind-set that this project wants to
promote. Games can do many things very well, but they
certainly cannot do everything at once .Street Racer is
enhanced by Implementing Unity. Many new things learnt by
implementing this I have went through various events
,functions and keyboards in Unity .This project aimed as much
at using alternative and innovative methods to teach through
coding digital games and playing games as part of learning, as
at developing the skills in extending academic goals to
understand, support and include the whole child: not only their
academic subject skills but also social, emotional and
behavioural skills.
                                                                  49
FUTURE SCOPE
1. I will like to add more features in future.
2. In Future likely to upload in playstore.
4. In Future likely to upload in Web based game.
3. Unity has very nice scope in future and building game with
Unity is good to grasp knowledge about different events and
functions.
                                                                50
Webliography
 A webliography is a list of websites that pertain to a given
topic. A webliography is much like a bibliography, but is
limited to a collection of online resources rather than books
and academic journals. Research has been conducted
comparing them to traditional bibliographies. Web Links
   1. https://docs.unity3d.com/Manual/index.html .
   2. http://unityassetcollection.com/
   3. http://ChargerGames@youtube.com/list=PLytjVIyAOStpT8xJ
      yijH4uG4nEPexvj18
                                                                51