Professional Documents
Culture Documents
COMPUTER GRAPHICS
Learning Aactivity-2
Aactivity COMPONENT
On
CERTIFICATE
This is to certify that the Unity 5 project titled “ROLLER BALL GAME” is an authentic
work carried out by JEEVAN J ACHARYA (1NT17CS072), K.R.GURUVYAS
(1NT17CS078) PRANAV P PATIL (1NT17CS127) and PUNNYA K A (1NT17CS137)
(1NT17CS137
bonafide students of Nitte Meenakshi Institute of Technology
Technology,, Bangalore in partial
fulfilment for the course “Computer
Computer Graphics
Graphics”, to award the degree of Bachelor of
Engineering in COMPUTER SCIENCE AND ENGINEERING of Visvesvaraya
Technological University, Belagavi during the ac
academic year 2019-2020.
__________________________
DECLARATION
(i) This Presentation does not contain text, graphics or tables copied and pasted from the
Internet, unless specifically acknowledged, and the source being detailed in the report and
in the References sections.
(ii) All corrections and suggestions indicated during the internal presentation have been
incorporated in the report.
(iii) Content of the report has been checked for the plagiarism requirement
Date: 10-04-2020
ACKNOWLEDGEMENT
The satisfaction and euphoria that accompany the successful completion of any task would
be incomplete without the mention of the people who made it possible, whose constant
guidance and encouragement crowned our effort with success. I express my sincere
gratitude to our Principal Dr H. C. Nagaraj, Nitte Meenakshi Institute of Technology for
providing facilities.
We wish to thank our HOD, Dr Thippeswamy M.N. for the excellent environment created
for further educational growth in our department. We also thank him for the invaluable
guidance provided which has helped in the creation of a better project.
I hereby like to thank our guideMrs. P Usha ShreeDepartment of Computer Science &
Engineering on their periodic inspection, time to time evaluation of the project and help to
bring the project to the present form.
Date: 10-04-2020
ABSTRACT
Serious video games applied for learning purposes play a significant and
important role for the modern technology enhanced education. The report
presents an educational 3D ball roller video game. The game was automatically
generated by means of declarative description by an open software tool
named Unity game platform.
The ball roller game here includes a ball being rolled in the game field and its
task involves collecting the cubes and scores a point for each one collected. In
this project we have implemented14 boxes and the ball is operated by the user
using direction keys from the keyboard. When the player is successful in
collecting all the boxes he wins the game.
TABLE OF CONTENTS
6 CONCLUSION 13
7 REFERENCES 14
1. INTRODUCTION
This project being developed using the above game engine is named as the
Roller Ball Game in which a spherical ball being the main game object attempts
to collect other random special game objects.
This involves creating the game objects along with their components, setting
the values on their properties and positioning them on the scene to create the
game. A player controls the ball around the game board and the ball is moved
using physics forces. The input from the player is accepted through the
keyboard and this input is used to apply forces to the ball to make it move in
the scene. The contact between the ball and the pickup game object is
detected and this event is used to pick up that particular game object. The
game counts the number of special objects collected and ends the game when
all of the game objects have successfully been collected.
1
2. INTRODUCTION TO UNITY
2. IDE: Unity provides a text editor to write the code. To reduce confusion,
sometimes, a distinct code editor is also used by developers. As the IDE
(Integrated development editor) of the unity engine supports C# and
Unity Script (JavaScript), it is used in the game development process for
creating immersive and exciting games.
3. Platform Support: The Unity engine is highly acceptable due to its ability
to support a total of 27 different platforms. It is used for developing and
deploying gaming apps that can be easily shared among personal
computers, mobile, and web platforms.
2
4. Debugging: Debugging and Tweaking is extremely easier with Unity
game development. During the game play, the game variables are
displayed, and it allows the developers to debug the process at run-time.
6. Graphics: The unity engine provides high-quality visual effects and audio.
The visuals developed by Unity are adaptable on every device and
screen without any compromise or distortion with the quality of the
images.
Unity is the most preferred gaming engine. On Unity, the coding part of the
game development process is only about 20%. Hence there is reduction in the
requirement of extensive programming skills.
The free license offered by Unity makes it open for game developers all over
the world. The developers are allowed to access the resources from the asset
store of Unity, which is used to enrich the process of mobile game
development.
3
3. REQUIREMENT SPECIFICATION
4
4. IMPLEMENTATION
Step3: Creation of a game board or the play field with the help of Unity
plane.
C# Script
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
5
void Start ()
{
rb = GetComponent<Rigidbody>();
count = 0;
SetCountText();
winText.text=””;
}
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis (“Horizontal”);
float moveVertical = Input.GetAxis (“Vertical”);
if (other.gameobject.CompareTag(“Pick Up”)) {
other.gameObject.SetActive (false);
count = count + 1;
SetCountText(); }
Void SetCountText () {
}
6
3. Moving the camera
Step 1: It includes tying the camera to the player game object by first
setting the position of the camera.
Step 2: It involves the associating the camera with player game object
with a script.
C# Script
using UnityEngine;
using System.Collections;
void Start () {
offset = transform.position – player.transform.position;
}
Void LateUpdate () {
Transform.position = player.transform.position + offset;
}
7
4. Setting up the Play Area
Step 1: Placement walls around the edges to keep the player game
object from falling off.
Step 3: The collectable objects being cube shaped structures, they are
associated with movement to grab the player’s attention over it.
To employ the movement of the objects, they are associated with a
script.
C# Script
using UnityEngine;
using System.Collections;
void Update ()
{
Transform.Rotate (new Vector3 (15, 30, 45) *
Time.deltaTime);
}
}
Step 4: This step involves making the pickup objects into a prefab.
This helps in making changes to a single instance in the scene.
8
5. Counting points
Step 4: The above step results in the falling of the game objects due
to gravity, to overcome this; the ‘use gravity’ component is disabled.
By doing this even though the cubes don’t respond to gravity, they
would still respond to physics forces.
Alternatively, the ‘use gravity’ and ‘is kinematic’ may be enabled, by
doing this the Rigid body component is set to be kinematic rigid body.
A kinematic rigid body doesn’t react to physics forces and it can be
animated and moved by its transform.
Step 2: To display a text when the game is over, the Unity’s UI tool
set is used.
Firstly a new UI test element is created from the hierarchy’s create
menu followed by changing the colour of the text and addition of
placeholder text.
To display the text at the upper-left corner when the game is being
played, it is anchored to the upper-left corner of the canvas.
9
Step 4: To display a message when all the cubes are collected another
text element is created and it is provided with the necessary
customizations and a function is associated with the text element in
the PlayerController script to display the text only when all the game
objects are collected.
Step 2: In this step the build settings window is opened, it shows the
build options for the currently selected platform.
Next the scenes are to be added to the build window, it can either be
done by the Add Current button or by dragging and dropping.
Finally the added scenes are built using the Build button.
Step 3: The game is run by executing the exe file generated during
the above step.
10
5. SNAPSHOTS
Fig 5.2: Initial view of the scene soon after the game is launched.
11
Fig 5.3: It represents the scene while the game is being played.
Fig 5.4: It represents the scene after the game is successfully completed.
12
6. CONCLUSION
This project developed called the Roller-Ball Game using the above
described game engine is an intelligible user-friendly game involving the
collection of cube shaped game objects with the help of a spherical
player object which is equipped with physics forces and hence moves in
response to the keyboard input provided by the physical player.
The player is indicated with the number of game objects picked up and
each time one is picked and the player is indicates as a winner once all
the game objects are successfully collected.
13
7. REFERENCES
[1]. https://www.youtube.com/watch?reload=9&v=W_fAidYRGzs
[2]. https://www.youtube.com/watch?v=7C7WWxUxPZE
[3]. https://www.youtube.com/watch?v=Xcm5H2J95iI
[4]. https://www.youtube.com/watch?v=dahT0wRVO1Q
[5]. https://www.youtube.com/watch?v=HlDGSStxuHI
[6]. https://www.youtube.com/watch?v=XtR29MmzuT0
[7]. https://www.youtube.com/watch?v=bFSLI2cmYYo
[8]. https://www.youtube.com/watch?v=hSg3e1M3hKY
[9]. https://www.capitalnumbers.com/blog/why-unity3d-popular/
14