3D CUBE RUNNERGAME
INTRODUCTION
SOFTWARE
CONCLUSION
4.
INTRODUCTION 3D GAME
The Unity game engine was introduced by Unity
Technologies in 2005, and has since become one among the
foremost popular platforms for developing 2D and 3D
games. it's been embraced both by small, third party
developers and by large commercial game development
companies. The functions that are supported by Unity3D are
very abundant. Unity3D produces the applications supported
JavaScript and/or C#. These are used to assign the animation
or real-time transition of the Game-Objects defined within
the application. GUI of Unity3D helps a replacement
developer to approach easily and script and program the
transition of the Game-Object. the newest version, Unity 5,
may be a fully functional game engine, with all advanced
features enabled and freely available to developers.
We are startmaking a game OR Use objects
Name
MAIN CAMERA OR Directional Light
These Objects Is always pre-defined in
the Game Engine
.CUBE First we will
take a cube .
. We madethe base using the
cube
. We made the player using the cube
we connected the camera to
the player
11.
Users haveto take care of
somethings while playing
the game
Cube Runner 2023-01-17 19-08-11.mp4
12.
if you wantdo play the game first
you will press any key
users have to hit in blue Box Itself
other wise Game will be over
13.
CONCLUSION
This studyaims to design and develop a gaming
application using Unity Game Engine. Through
this cornerstone for a new concentration on
Game Development, we have conveyed our views
and ideas on improving focus via entertainment.
The functions that Unity3D supports
autonomously are very abundant. All game
developments are possible such as shader,
physics engine, network, terrain manipulation,
audio, video, and animation, and it is enabled so
that it is possible to revise, meeting demand of
user according to the need.
14.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FollowPlayer : MonoBehaviour
{
public Transform playerTransfer;
public float offset;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
Vector3 cameraPos =transform.position;
cameraPos.z=playerTransfer.position.z+offset;
transform.position=cameraPos;
}
}
private void FixedUpdate()
{
rigidbody.AddForce(0,0,force*Time.deltaTime);
}
}
15.
using System.Collections;
using System.Collections.Generic;
using UnityEngine.SceneManagement;
using UnityEngine;
public class GameController : MonoBehaviour
{
public GameObject gameOverPanel;
public GameObject tapToStart;
public GameObject scoreText;
public GameObject pasueMenu;
private void Start() {
gameOverPanel.SetActive(false);
tapToStart.SetActive(true);
scoreText.SetActive(false);
PauseGame();
}
private void Update() {
if(Input.GetKeyDown(KeyCode.Mouse0)){
StartGame();
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameController1 : MonoBehaviour
{
public GameObject pauseMenu;
public GameObject pauseButton;
public GameObject StartButton;
public GameObject tapToStart;
void Start()
{
pauseMenu.SetActive(false);
pauseButton.SetActive(false);
}
// Update is called once per frame
void Update()
{
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine.SceneManagement;
using UnityEngine;
public class LevelLoaders : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void Reload()
{
SceneManager.LoadScene("Game");
}
public void QuitGame(){
Application.Quit();
}
}
20.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerCollision : MonoBehaviour
{
public PlayerScript playerScript;
public Score score;
public GameController gameController;
public AudioSource audioSource;
public AudioSource audioSource1;
private void OnTriggerEnter(Collider other) {
if (other.gameObject.tag=="Collectables")
{
Destroy(other.gameObject);
score .AddScore(1);
audioSource.Play();
}
}
private void OnCollisionEnter(Collision other) {
if(other.gameObject.tag=="Obstacles"){
gameController.GameOver();
playerScript.enabled = false;
audioSource1.Play();
}
}
}
21.
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine;
public class Score : MonoBehaviour
{
public Text scoreText;
public Text finalScoreText;
int myscore =0;
void Update()
{
scoreText.text = myscore.ToString();
finalScoreText.text = "Score: "+myscore.ToString();
}
public void AddScore(int score){
myscore = myscore + score;
}
}
22.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerScript : MonoBehaviour
{
public Rigidbody rigidbody;
public float force=1000f;
public float speed=10f;
public float maxX;
public float minX;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
Vector3 playerPos = transform.position;
playerPos.x = Mathf.Clamp(playerPos.x, minX,maxX);
transform.position=playerPos;
if (Input.GetKey(KeyCode.RightArrow))
{
transform.position = transform.position + new Vector3(speed*Time.deltaTime,0,0);
}