Search Unity

How this can be done as in this game?

Discussion in 'Scripting' started by ratg97, Aug 23, 2014.

  1. ratg97

    ratg97

    Joined:
    Aug 4, 2014
    Posts:
    65
    The game line runner for android ... the question is how it's done for the game and make 3 different jumps pressures depending on how the screen ... I've looked on youtube and forums etc ... na na. but .. only some Java script ... and I want C #

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class ControladorPersonaje : MonoBehaviour {
    5.    
    6.     public float fuerzaSalto = 100f;
    7.     private bool corriendo = false;
    8.     public float velocidad = 1f;
    9.     private bool enSuelo = true;
    10.     public Transform comprobadorSuelo;
    11.     private float comprobadorRadio = 0.07f;
    12.     public LayerMask mascaraSuelo;
    13.    
    14.     void FixedUpdate(){
    15.         if(corriendo){
    16.             rigidbody2D.velocity = new Vector2(velocidad, rigidbody2D.velocity.y);
    17.         }
    18.  
    19.         enSuelo = Physics2D.OverlapCircle(comprobadorSuelo.position, comprobadorRadio, mascaraSuelo);
    20.  
    21.     }
    22.    
    23.  
    24.     void Update () {
    25.        
    26.         if(Input.GetMouseButtonDown(0)){
    27.             if(corriendo){
    28.                 // Hacemos que salte si puede saltar
    29.                 if(enSuelo){
    30.                     rigidbody2D.velocity = new Vector2(rigidbody2D.velocity.x, fuerzaSalto);
    31.                 }
    32.             }else{
    33.                 corriendo = true;
    34.             }
    35.         }
    36.     }
    37. }
    38.  
     
  2. domkia

    domkia

    Joined:
    Aug 19, 2012
    Posts:
    99
    Isnt this code in csharp?
     
  3. geroppo

    geroppo

    Joined:
    Dec 24, 2012
    Posts:
    140
    it is indeed c#
     
  4. ratg97

    ratg97

    Joined:
    Aug 4, 2014
    Posts:
    65
    Chasrp.... please help me
     
  5. domkia

    domkia

    Joined:
    Aug 19, 2012
    Posts:
    99
    So what is your problem? Please describe it so we can help. And stop those ... its annoying.
     
  6. ratg97

    ratg97

    Joined:
    Aug 4, 2014
    Posts:
    65
  7. Fluzing

    Fluzing

    Joined:
    Apr 5, 2013
    Posts:
    815
    To be honest, timers are basic programming. If you do not know how to make a timer, you should do some more programming tutorials. There are good ones on YouTube.
     
  8. ratg97

    ratg97

    Joined:
    Aug 4, 2014
    Posts:
    65
    but i dont know how merge the timer with the input
     
  9. smitchell

    smitchell

    Joined:
    Mar 12, 2012
    Posts:
    702
    Dude you're getting really annoying. You've created multiple posts about the same topic.. You don't understand programming at all; which is fine but it appears that you have no intention of spending the time to learn the basics. We're not here to write your code for you, We're here to help you write it yourself.
     
    domkia likes this.
  10. ScriptKid

    ScriptKid

    Joined:
    Aug 8, 2014
    Posts:
    23
    let the timer count upwards while holding key after release the key multiply jumpheight or whatever with your counter
    good luck