JUEGO COMPLETO DE CARRERAS. INSPIRADO EN LA PELICULA CARROS DE FUEGO.
MOUSE GIRAR, TECLAS W-A-S-D CORRER ESPACIO SALTAR
https://paco415.gamejolt.io
https://gamejolt.com/games/ROBOTS_DE_FUEGO/495937
scripts del juego.
c#
----------------------------------------------------------------------------------------------------------------------------
El corredor salta.
--------------------------------------------------------------------------------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class especialsaltoyabance : MonoBehaviour {
public float moveSpeed = 10f;
public float turnSpeed = 50f;
void Update ()
{
if (Input.GetKeyUp(KeyCode.Space))////funciona contantemente al apretar W mayusculas a de ser
//if (Input.GetKeyDown(KeyCode.W))// funciona pasito a pasito
//if(Input.GetKey(KeyCode.UpArrow))
transform.Translate(Vector3.forward * moveSpeed * Time.deltaTime);
}
}
---------------------------------------------------------------------------------------------------------------------------
using System.Collections.Generic;
using UnityEngine;
public class especialsaltoyabance : MonoBehaviour {
public float moveSpeed = 10f;
public float turnSpeed = 50f;
void Update ()
{
if (Input.GetKeyUp(KeyCode.Space))////funciona contantemente al apretar W mayusculas a de ser
//if (Input.GetKeyDown(KeyCode.W))// funciona pasito a pasito
//if(Input.GetKey(KeyCode.UpArrow))
transform.Translate(Vector3.forward * moveSpeed * Time.deltaTime);
}
}
---------------------------------------------------------------------------------------------------------------------------
script para pasar nivel, ejemplo.
---------------------------------------------------------------------------------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class pasanivelganas : MonoBehaviour {
//public AudioSource tickSource;
void Start () {
//tickSource = GetComponent<AudioSource> ();
}
void Update () {
}
void OnTriggerEnter(Collider other) {
//if (other.gameObject.CompareTag ("PASOVERDE")){
//if (other.gameObject.CompareTag ("ogri2")){
if (other.gameObject.CompareTag ("FPSController")){
//transform.Rotate (new Vector3 (0 * Time.deltaTime, 91, 90), Space.Self);////SOLO ROTA PERO PARA QUE?¿
//tickSource.Play ();
Application.LoadLevel (1);
}}
}
using System.Collections.Generic;
using UnityEngine;
public class pasanivelganas : MonoBehaviour {
//public AudioSource tickSource;
void Start () {
//tickSource = GetComponent<AudioSource> ();
}
void Update () {
}
void OnTriggerEnter(Collider other) {
//if (other.gameObject.CompareTag ("PASOVERDE")){
//if (other.gameObject.CompareTag ("ogri2")){
if (other.gameObject.CompareTag ("FPSController")){
//transform.Rotate (new Vector3 (0 * Time.deltaTime, 91, 90), Space.Self);////SOLO ROTA PERO PARA QUE?¿
//tickSource.Play ();
Application.LoadLevel (1);
}}
}
----------------------------------------------------------------------------------------------------------------------------
------pasar de nivel otro ejemplo de script--------------------------------
---------------------------------------------------------------------------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PASANIVELGANAS1 : MonoBehaviour {
//public AudioSource tickSource;
void Start () {
//tickSource = GetComponent<AudioSource> ();
}
void Update () {
}
void OnTriggerEnter(Collider other) {
//if (other.gameObject.CompareTag ("PASOVERDE")){
//if (other.gameObject.CompareTag ("ogri2")){
if (other.gameObject.CompareTag ("CORREDOR1 (4)")){
//transform.Rotate (new Vector3 (0 * Time.deltaTime, 91, 90), Space.Self);////SOLO ROTA PERO PARA QUE?¿
//tickSource.Play ();
Application.LoadLevel (2);
}}
}
----------------------------------------------------------------------------------------------------------
using System.Collections.Generic;
using UnityEngine;
public class PASANIVELGANAS1 : MonoBehaviour {
//public AudioSource tickSource;
void Start () {
//tickSource = GetComponent<AudioSource> ();
}
void Update () {
}
void OnTriggerEnter(Collider other) {
//if (other.gameObject.CompareTag ("PASOVERDE")){
//if (other.gameObject.CompareTag ("ogri2")){
if (other.gameObject.CompareTag ("CORREDOR1 (4)")){
//transform.Rotate (new Vector3 (0 * Time.deltaTime, 91, 90), Space.Self);////SOLO ROTA PERO PARA QUE?¿
//tickSource.Play ();
Application.LoadLevel (2);
}}
}
----------------------------------------------------------------------------------------------------------
pasar a otro nivel tocando una tecla en este caso la "escape"
-------------------------------------------------------------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class tocateclaycambianivel : MonoBehaviour {
// Use this for initialization
void Start () {
}
void Update ()
{
//if (Input.GetKey(KeyCode.P))
if (Input.GetKey(KeyCode.Escape ))
//void OnCollisionEnter (){
//Destroy (gameObject, 0.00f);
Application.LoadLevel (0);
}
}
-----------------------------------------------------------------------------------------------------------------
using System.Collections.Generic;
using UnityEngine;
public class tocateclaycambianivel : MonoBehaviour {
// Use this for initialization
void Start () {
}
void Update ()
{
//if (Input.GetKey(KeyCode.P))
if (Input.GetKey(KeyCode.Escape ))
//void OnCollisionEnter (){
//Destroy (gameObject, 0.00f);
Application.LoadLevel (0);
}
}
-----------------------------------------------------------------------------------------------------------------
ejemplo una animacion presionando tecla "w"
--------------------------------------------------------------------------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CONTROLHUMANO : MonoBehaviour {
// Use this for initialization
//void Start () {
//}
public Animator Anim;
public float WalkSpeed;
// Update is called once per frame
void Update () {
if (Input.GetKey (KeyCode.W)) {
Anim.SetBool ("Walking", true);
transform.Translate (Vector3.forward * WalkSpeed * Time.deltaTime);
} else {
Anim.SetBool ("Walking", false);
}
}
}
using System.Collections.Generic;
using UnityEngine;
public class CONTROLHUMANO : MonoBehaviour {
// Use this for initialization
//void Start () {
//}
public Animator Anim;
public float WalkSpeed;
// Update is called once per frame
void Update () {
if (Input.GetKey (KeyCode.W)) {
Anim.SetBool ("Walking", true);
transform.Translate (Vector3.forward * WalkSpeed * Time.deltaTime);
} else {
Anim.SetBool ("Walking", false);
}
}
}
No hay comentarios:
Publicar un comentario