Sei sulla pagina 1di 40

CRAZY THEIF

Department of Computer Science


Mohammad Ali Jinnah University,
Islamabad.

Project Report

Prepared By:
1. Fahad Rasheed
2. Syed Ammar Hussain Kazmi

BC103016
BC103076

Supervise by:
Mr.Adnan Khalid

January 15, 2015

Supervisors Signature ____________

Abstract

The focus of our project is to design a game using unity 3d game engine. The player,
plays as a thief, who has to run and avoid the obstacles in the way, And from the
policeman who is chasing him. The game is designed for Android environment. In our
project, we have used multiple built-in functions that unity 3d game engine provides.
As a final product, we have developed a game that is fun and enjoyable.

Contents
CRAZY THEIF
1.

Introduction
1.1 Purpose
1.2 Scope
1.3 Objective
1.4 Tools & Techniques
1.4.1 Tools
1.4.2 Language
1.5 Time lines

2.

Software Requirement Analysis


2.1 Functional / Non Functional Requirements
2.2 Use Case Diagram
2.2 Use Case Description
2.2.1 Description of Use Case 1
2.2.2 Description of Use Case 2
2.2.3 Description of Use Case 3
2.2.4 Description of Use Case 4
2.2.5 Description of Use Case 5
2.2.6 Description of Use Case 6
2.2.7 Description of Use Case 7
2.2.8 Description of Use Case 8

3.

System Design
3.1 System Sequence Diagram
3.1.1 Move Left
3.1.2 Move right
3.1.3 Slide down
3.1.4 Jump
3.1.5 Make sounds
3.1.6 Calculate score
3.1.7 Measures distance
3.1.8 Increase multiplier
3.2 System Architecture Diagram

Implementation
4.1 Tools and Technologies Used
4.1.2 Unity 3D
4.1.3 Maya
4.2 Software Description (coding)
4.2.1 How Game Starts
4.2.2 Replace the object

Deployment
5.2 Installation process description
5.2.1 How to install the Game
5.3 External dependencies
5.3.1 System Requirements
5.3.2 Android Devices

Conclusion
6.2 Evaluation of objective and aim

Appendix

CHAPTER 1
Introduction

1. Introduction
The application is a 3D-Android game Crazy Thief on his big Adventure. The thief
who is not only smart but also a clever runner who is being chased by the policeman
after he beats a lady. But beware! He faces different hurdles and obstacles along the
way. Explore fully interactive level less game and collect gold coins at every turn!
Gain as much money as you can. Everyone try to catch you but you are smart. This
game is pretty simple and casual, which takes you on the adventurous track, you will
never forget.

1.1

Purpose
The purpose of the project is to develop a game with a lighthearted feel and graphics.
This probably is going to make a sensation within the first minute.

1.1.1.List of deliverables
A Fully Functional Game at the end of the project.

1.2

Scope
The Scope of this project is to develop a game that will be challenging for the player.
The players will have to make quick decision to avoid the hurdles and obstacles as
the policeman try to catch him.

1.3

Objective
The main objectives which are implemented in this project are following.
To build an interesting game for user to play.
To build a game that improves the decision making power of a human as he/she has
to make a decision quickly.

1.4 Tools & Techniques


1.4.1 Tools
Unity 3D, Maya 2012
1.4.2 Language
C#, JavaScript

1.5

Time lines

Deadlines

Artifacts

Final Project Part-2


(Mid-Term)

Players moves , Track/Path, Score calculation

Final Project

Fully functional tested project.

CHAPTER 2
Software Requirement Analysis

2. Software Requirement Analysis


Requirement analysis is a process of understanding the user needs and expectations from a
proposed system or application and is a well-defined stage in the software development life
cycle model.

2.1

Functional / Non Functional Requirements

Functional requirement documents the operations and activities that a system must be able
to perform
Ref.
No

Functional requirements

Priority

Nonfunctional
requirements

Category

R1

System must allow the Player


to move the thief left.

Must

System should be
available for 24/7.

Availability

R2

System must allow the Player


to move the thief right.

Must

System should be
available for 24/7.

Availability

R3

System must allow the Player


to swipe the thief when
he/she drag the screen
Downwards.

Must

System should be
available for 24/7.

Availability

R4

System must allow the Player


to jump the thief up when
he/she drag the screen
upwards.

Must

System should be
available for 24/7.

Availability

R5

System should make different


sounds if Thief (run,
swipe/slide, jump, collect
points).

Must

System should be
available for 24/7.

Availability

R6

System should Calculate the


Score and display it.

Must

System should be
available for 24/7.

Availability

R7

System should measure the


Distance travelled by the
player.

Must

System should be
available for 24/7.

Availability

R8

System should increase the


multiplier.

Must

System should be
available for 24/7.

Availability

2.2 Use Case Diagram

Move left

Move
right
Swipe
down
Jump
System
Make
sounds
Player
Calculate
score
Measures
distance

Increase
multiplier

Figure 2.2(Use case diagram)

2.2

Use Case Description

2.2.1 Description of Use Case 1

Use Case ID:


Use Case Name:

1
Move left

Author Name:

Fahad

Date Created:

Jan 15, 2015

Actors/Entity:

Player

Brief Description:

Preconditions:
Post conditions:

In order to move the thief left the player has to drag the screen from right
to left.
The player drags the screen from right to left.
The system should move the thief on left side on the track on which the
thief is running.

Normal Flow:

Actor Action

1. The Actor drags the screen


from right to left.

System Response

2. System moves the thief on left.

2.2.2 Description of Use Case 2

Use Case ID:


Use Case Name:

2
Move right

Author Name:

Fahad

Date Created:

Jan 15, 2015

Actors/Entity:

player

Brief Description:
Preconditions:

In order to move the thief right the player has to drag the screen from left
to right.
The player drags the screen from left to right.

10

Post conditions:

The system should move the thief on right side on the track on which the
thief is running.

Normal Flow:

Actor Action

1. The Actor drags the screen


from right to right.

System Response

2. System moves the thief on right.

2.2.3 Description of Use Case 3

Use Case ID:


Use Case Name:

3
Slide downwards

Author Name:

Fahad

Date Created:

Jan 15, 2015

Actors/Entity:

player

Brief Description:
Preconditions:
Post conditions:
Normal Flow:

In order to swipe the thief downwards the player has to drag the screen
from up to down.
The player drags the screen from up to down.
The system should swipe the thief downwards.
Actor Action

1.The Actor drags the screen from


u. to down

11

System Response

2. System swipe the thief


downwards.

2.2.4 Description of Use Case 4

Use Case ID:


Use Case Name:

4
jump

Author Name:

Fahad

Date Created:

Jan 15, 2015

Actors/Entity:

player

Brief Description:
Preconditions:
Post conditions:

In order to swipe the thief upwards the player has to drag the screen
upwards.
The player drags the screen upwards.
The system should lift the thief up.

Normal Flow:

Actor Action

1. The Actor drags the screen


upwards.

System Response

2. System lifts the thief up.

2.2.5 Description of Use Case 5

Use Case ID:


Use Case Name:

5
make sounds

Author Name:

Fahad

Date Created:

Jan 15, 2015

Actors/Entity:

player

Brief Description:
Preconditions:
Post conditions:

In order to make different sounds, the player has to move (left, right),
jump, and slide down the thief on the track.
The player drags the screen in any direction to move the thief.
The system should make sound in reaction of players action.

12

Normal Flow:

Actor Action

1. The Actor drags the screen.

System Response

2. System makes sounds.

2.2.6 Description of Use Case 6


Use Case ID:
Use Case Name:

6
Calculate score

Author Name:

Fahad

Date Created:

Jan 15, 2015

Actors/Entity:

system

Brief Description:
Preconditions:
Post conditions:

In order to calculate the score systems should record the number of coins
collected by the player.
Game starts.
The systems calculate the score and display it.

Normal Flow:

Actor Action

1.Game starts

System Response

2. System calculates the score and


displays it.

2.2.7 Description of Use Case 7

Use Case ID:


Use Case Name:

7
Measured distance

Author Name:

Fahad

Date Created:

Jan 15, 2015

Actors/Entity:

system

Brief Description:
Preconditions:

In order to measure the distance systems should follow the thief.


Game starts.

13

Post conditions:

The systems measure the distance and display it.

Normal Flow:

Actor Action

1.Game starts

System Response

2. System measures the distance


and displays it.

2.2.8 Description of Use Case 8

Use Case ID:


Use Case Name:

8
Increase multiplier

Author Name:

Fahad

Date Created:

Jan 15, 2015

Actors/Entity:

system

Brief Description:
Preconditions:
Post conditions:
Normal Flow:

In order to increase the multiplier of the player systems should check the
distance covered by the thief. More distance covered, increase multiplier.
Game starts.
The systems system check the distance covered by the thief. And
increase the multiplier over time.
Actor Action

1.Game starts

System Response

2. System increases the multiplier


over time.

14

CHAPTER 3
System Design

3. System Design
System design is the process of defining the architecture, components and data for the
system to satisfy specified requirements.

15

3.1 System Sequence Diagram


System diagram are created to show the sequence of events among different objects in
system.
3.1.1

Move Left

:
System

Us
er
Drags the screen right to left
Move the thief on left

Brief Description:
In order to move the thief left the player has to drag the screen from right to left.
3.1.2

Move right

:
System

Us
er
Drags the screen left to right
Moves the thief on right

Brief Description:
Drags
In order to move the thief left the
playerthe
hasscreen
to drag downwards
the screen from right left to right.
3.1.3

Slide down

Force the thief to swipe down

16

:
System

Us
er

Brief Description:
In order to swipe the thief downwards the player has to drag the screen from up to down.
3.1.4

Jump

:
System

Us
er
Drags the screen upwards
Lift the thief up in the air

Brief Description:
In order to swipe the thief upwards the player has to drag the screen upwards.
3.1.5

Make sounds
Performs different actions
Makes sounds in response

17

:
System

.
Us
er

Brief Description:
In order to make different sounds, the player has to move (left, right), jump, and slide down
the thief on the track.
3.1.6

Calculate score

:
System

Us
er
Start playing the game

Calculates the score over time and display it

Brief Description:
In order to calculate the score systems follow the distance covered by the thief.
3.1.7

Measures distance

Starts playing the game

:
System

Calculate the distance travelled over time


Us
er
18

Brief Description:
In order to measure the distance systems should follow the thief.
3.1.8

Increase multiplier

:
System

Us
er

Play game, cross hurdles, moves on


Increase multiplier over time

Brief Description:
In order to increase the multiplier of the player systems should check the distance covered
by the thief. More distance covered, increase multiplier.

3.2 System Architecture Diagram

19

Device

20

CHAPTER 4
Implementation

4 Implementation
Implementation is the carrying out, execution, or practice of a plan, a method, or any design
for doing something.

4.1 Tools and Technologies Used


4.1.2 Unity 3D
Unity is a cross-platform game creation system developed by Unity Technologies, including
a game engine and integrated development environment (IDE). It is used to develop video
games for web sites, desktop platforms, consoles, and mobile devices. Unity is notable for its
ability to target games to multiple platforms. Within a project, developers have control over

21

delivery to mobile devices, web browsers, desktops, and consoles. Supported platforms
include BlackBerry 10, Windows Phone 8, Windows, Android, iOS.

4.1.3 Maya
Maya 3D animation, modeling, simulation, rendering, and compositing software offers a
comprehensive creative feature set on a highly extensible production platform. Maya
provides high-end character and effects toolsets along with increased productivity for
modeling, texturing, and shade creation tasks.

4.2 Software Description (coding)


4.2.1 How Game Starts
1) When game starts unity call two methods:
.Void Start ()
.Void Update ()
These methods automatically create when you make a script in Unity.
2) Unity call Start () method just one time when game starts.
After that unity call Update method again and again.
3) Now we define two methods which we call in the Start () method
Create Cell () that creates one cell on my defined position
Create Player () that create player which we already defined as inspector.
Void Start ()
{
Create Cell ();

//create one cell on specific position

Create Player ();

//create player on the cell

}
4) We define three methods in the method Update():
Void Update ()
{
Update Player();
Update Coins();
Create New Cells If Needed (false) ;
}
Update Player()

22

Update the player, means when the user will give input to the system then according to given
input player perform its actions like jump, slide.
Update Coins()
Second method update the coins on each cells means on which position coins are to be
shown. Create coins () is define in update coin(). We write in update() because when game
starts on the first cell no coins were placed. Thats why we used update coin() in update ()
method.
Third method dynamically creates new cells and destroy previous cells when player visit the
cell once, then it destroy it and create a new one in different positions. We used only twelve
cells in the game. Our dynamically cells creation algorithm randomly select cell out of twelve
and place them at random position.
4.2.2 Replace the object
When player died and game ends, then the system call two functions:
Ragdoll ();
On GUI ();
First method will call when player died so what id does it replace the player with ragdoll.
Basically rag doll is a dead character we also use in our project.
If (player==null)
{
Game Object Rag Doll;
Player=Rag Doll;
}

4.2.3

Game Scripting
PLATFORM GENERATION SCRIPT

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class PLATFORMSCRIPTS : MonoBehaviour
{

23

public GameObject runnerRef;


public int NumberOfPlatforms = 3;
public float DistanceToRecycle = 0;
float angle = 90.0f;
public List<GameObject> platforms = new List<GameObject>();
// Use this for initialization
void Start()
{
runnerRef = GameObject.FindGameObjectWithTag("Running");
GameObject platformPrefeb = Resources.Load("prefebs/platform") as GameObject;
for (int i = 0; i < NumberOfPlatforms; i++)
{
GameObject g = Instantiate(platformPrefeb, Vector3.zero, Quaternion.AngleAxis(angle, new
Vector3(0, 1, 0))) as GameObject;
Vector3 tempScale = new Vector3(10, 13, 13);
g.transform.localScale = tempScale;
Vector3 tempPosition = new Vector3();
if (platforms.Count > 0)
{
tempPosition = platforms[platforms.Count - 1].transform.position;
tempPosition.z += platforms[platforms.Count - 1].transform.localScale.z * .5f;
}
g.transform.position = tempPosition;
g.transform.parent = gameObject.transform;
platforms.Add(g);

}
}
// Update is called once per frame
void Update()
{
if (platforms[0].transform.position.z + DistanceToRecycle < runnerRef.transform.position.z)
{
GameObject g = platforms[0];
platforms.Remove(g);
//---------------------------------Vector3 tempScale = new Vector3(10, 13, 13);
g.transform.localScale = tempScale;
Vector3 tempPosition = new Vector3();
if (platforms.Count > 0)
{
tempPosition = platforms[platforms.Count - 1].transform.position;
tempPosition.z += platforms[platforms.Count - 1].transform.localScale.z * .5f;
}

24

g.transform.position = tempPosition;
g.transform.parent = gameObject.transform;
platforms.Add(g);
}
}
}
PLAYER GENERATION SCRIPT
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class character : MonoBehaviour
{
public GameObject gg;
void Start()
{
}
// Update is called once per frame
void Update()
{
float moveInputZ = Input.GetAxis("Horizontal") * Time.deltaTime * 2;
gg.transform.position += new Vector3(0, 0, Time.deltaTime * 2);
rigidbody.animation.Play("run");
}
//-------------------------------------------------}

LADY SCENE SCRIPT


using UnityEngine;
using System.Collections;
public class lady : MonoBehaviour {
public GameObject plarer;
int count = 0;
// Use this for initialization
void Start () {

25

plarer.animation.Play("punch");
plarer.animation.Play("punch");

}
// Update is called once per frame
void Update () {
count++;

plarer.animation.Play("run");
float moveInputZ = Input.GetAxis("Horizontal") * Time.deltaTime * 6;
// transform.position -= new Vector3(0, 0, moveInputZ);
transform.position += new Vector3(0, 0, Time.deltaTime * 8);
if (count == 120)
{
Application.LoadLevel("NEWONE");
}
}
}

POLICE SCENE SCRIPT


using UnityEngine;
using System.Collections;
public class mainscene : MonoBehaviour {
int count = 0;
void Update()
{

count++;
float moveInputZ = Input.GetAxis("Horizontal") * Time.deltaTime * 6;
// transform.position -= new Vector3(0, 0, moveInputZ);

26

transform.position -= new Vector3(0, 0, Time.deltaTime * 8);


if (count ==140)
{
Application.LoadLevel("SELECT");
}
}
}
COINS SCRIPT

cc1=PlayerPrefs.GetInt("coin1");
if (cc1 == 1)
{
GameObject coin = (GameObject)Instantiate(m_GoldCoin, pos + laneOffset,
Quaternion.Euler(0, 360.0f / (k + 0.5f), 0));
cell.m_coins.Add(coin);
}
if (cc1 == 2)
{
GameObject coin = (GameObject)Instantiate(m_GoldCoin1, pos + laneOffset,
Quaternion.Euler(0, 360.0f / (k + 0.5f), 0));
cell.m_coins.Add(coin);
}
if (cc1 == 3)
{
GameObject coin = (GameObject)Instantiate(m_GoldCoin2, pos + laneOffset,
Quaternion.Euler(0, 360.0f / (k + 0.5f), 0));
cell.m_coins.Add(coin);
}
private void UpdateCoins()
{

27

if (m_player == null)
return;

for (int c = 0; c < m_cells.Count; c++)


{
for (int k = m_cells[c].m_coins.Count - 1; k >= 0; k--)
{
if (Vector3.Distance(m_cells[c].m_coins[k].transform.position, m_player.transform.position) <
0.3f)
{
AudioSource.PlayClipAtPoint(m_chingAudio, m_player.transform.position);
Destroy(m_cells[c].m_coins[k]);
m_cells[c].m_coins.RemoveAt(k);
m_coinsCollected++;
}
}
}
}

28

CHAPTER 5
Deployment

5 Deployment
Deployment is all of the activities that make software available for use.

29

5.2 Installation process description


5.2.1

How to install the Game

Step 1:
Go to the Google Play Store and search for Crazy Thief on your Android tablet or
Smartphone.
Step 2:
Press the download button.
Step 3:
Install the game and start playing.

5.3 External dependencies


5.3.1 System Requirements
Minimum system requirements are given below,
1
2
3

OS 2.3.1 or later
ARMv7 (Cortex) CPU or Atom CPU
OpenGL ES 2.0 or later.

5.3.2 Android Devices


We have tested the game on different devices,
1.
2.
3.
4.
5.

Samsung galaxy S3
Samsung galaxy S3(Neo)
Qmobile Noir A10
Sony Xperia
Prestigio Multipad 7.0

30

CHAPTER 6
Conclusion

6 Conclusion
6.2 Evaluation of objective and aim
The main objectives which are implemented in this project are following.
To build an interesting game for user to play.

31

To build a game that improves the decision making power of a user as he/she has to make a
decision quickly.

32

Appendix

Figure 3.2.1(Splash)

33

Figure 3.2.2(Menu)

34

Figure 3.2.3(Play)

35

Figure 3.2.4(Free Character Store)

36

Figure 3.2.5(Free store for Coins)

37

Figure 3.2.6(Score)

38

Figure 3.2.7(Help)

39

Figure 3.2.8(Game End)

40

Potrebbero piacerti anche