Search Unity

Aircows

Discussion in 'Works In Progress - Archive' started by deepboom, Apr 29, 2012.

  1. deepboom

    deepboom

    Joined:
    Apr 29, 2012
    Posts:
    9
    Hello,

    I would really appreciate some comments about this game , this is an early version of the game.
    The game is very simple , you just have to save the cows ... get them safe to the ground with a parachute.

    I'm starting to make the game levels now , and will add some guys to make the task harder for the player.

    http://youtu.be/-MP7p56Mwa8

    Thanks,
     
    Last edited: May 2, 2012
  2. softwizz

    softwizz

    Joined:
    Mar 12, 2011
    Posts:
    793
    I like it, I would like the visible area to be smaller (closer to the plane so not seeing so much sky) with a radar to show cow locations.

    I would love your plane controller code, how is it done because I am having a nightmare trying to get that sort of controll. I am using 3D assets with my Aeroplane confined to the Z Y axis.

    Thanks.
     
  3. deepboom

    deepboom

    Joined:
    Apr 29, 2012
    Posts:
    9
    Thanks for the reply,

    1)the camera distance will be customized.

    2) the controlling isn't finished yet , the plane will auto rotate when upside down , right now you need some practice to control the plain ... But that will be customized also.

    The code it's pretty simple ... Let me show how I did it , this is not optimized ... is the first code that I made with unity and will make a new one, once I have the controls finalized, now is just a quick working prototype. I deleted some parts , but what is here is enough to understand.

    Code (csharp):
    1. public class AirplaneScript : MonoBehaviour {
    2.     public float RotationSpeed;
    3.     public float SpeedOriginal;
    4.     public float TopSpeed;
    5.     //private
    6.     public Vector3 DirectionPlane;
    7.     public Vector3 Direction;
    8.     private bool RotatingRight;
    9.     private bool RotatingLeft;
    10.     private bool Rotating180;
    11.     private bool FacingRight;
    12.     private bool FacingLeft;
    13.     private float SpeedBoost;
    14.     private bool Boost;
    15.     private float GravityAngle;
    16.     private float GravityVelocity;
    17.     public Vector3 GravityVector;
    18.     private bool d_AirplaneCrashed;
    19.     private int d_NumberOfParachutes;
    20.     private float t_z_rot_store;
    21.     private float t_x_rot_store;
    22.     private float t_airplane_180;
    23.     private bool t_inverse_rotation;
    24.    
    25.     // Use this for initialization
    26.     void Start ()
    27.     {
    28.         RotatingRight=false;
    29.         RotatingLeft=false;
    30.         FacingRight=true;
    31.         FacingLeft=false;
    32.         d_AirplaneCrashed=false;
    33.         SpeedBoost=SpeedOriginal;
    34.         Direction = transform.forward;
    35.     }
    36.    
    37.    
    38.     ////////////////////////////
    39.     //ROTATE RIGHT
    40.     void RotateAirPlaneRight()
    41.     {
    42.         t_z_rot_store=transform.localRotation.eulerAngles.z;
    43.         t_x_rot_store=-1*transform.localRotation.eulerAngles.x;
    44.         SpeedBoost=SpeedOriginal;
    45.         RotatingRight=true;
    46.         RotatingLeft=false;
    47.         FacingLeft=false;
    48.         t_airplane_180=0.0f;
    49.        
    50.         if(Direction.normalized.x>0.0f)
    51.         {
    52.             t_inverse_rotation=true;
    53.         }
    54.         else
    55.         {
    56.             t_inverse_rotation=false;
    57.         }
    58.     }
    59.    
    60.     ////////////////////////////
    61.     //ROTATE LEFT
    62.     void RotateAirPlaneLeft()
    63.     {
    64.        
    65.     }
    66.    
    67.    
    68.    
    69.    
    70.     // Update is called once per frame
    71.     void Update ()
    72.     {
    73.        
    74.         Boost=false;
    75.         Direction = transform.forward; 
    76.        
    77.        
    78.         transform.position +=   Direction*SpeedBoost* Time.deltaTime ;
    79.        
    80.         /////////////////////////////
    81.         //UP
    82.         if(Input.GetKey(KeyCode.UpArrow))
    83.         {
    84.             if(RotatingRight==false  RotatingLeft==false)
    85.             {
    86.                 if(FacingLeft)
    87.                 {
    88.                     transform.RotateAround(transform.position, Vector3.back, RotationSpeed * Time.deltaTime);
    89.                 }
    90.                 if(FacingRight)
    91.                 {
    92.                     transform.RotateAround(transform.position, Vector3.forward, RotationSpeed * Time.deltaTime);   
    93.                 }
    94.             }
    95.         }
    96.        
    97.         /////////////////////////////
    98.         //DOWN
    99.         if(Input.GetKey(KeyCode.DownArrow))
    100.         {
    101.             ///            
    102.         }
    103.        
    104.         /////////////////////////////
    105.         //RIGHT
    106.         if(Input.GetKey(KeyCode.RightArrow))
    107.         {
    108.             if(FacingLeft==true  RotatingRight==false  RotatingLeft==false)
    109.             {
    110.                
    111.                 if(transform.position.z>-10.0f  transform.position.z<10.0f)
    112.                 {
    113.                     RotateAirPlaneRight();
    114.                 }  
    115.                
    116.             }
    117.             else
    118.             {
    119.                 Boost=true;
    120.             }
    121.         }
    122.        
    123.         /////////////////////////////
    124.         //LEFT
    125.         if(Input.GetKey(KeyCode.LeftArrow))
    126.         {
    127.            //////
    128.         }
    129.        
    130.        
    131.         /////////////////////////////
    132.         //ROTATION CODE
    133.        
    134.         //////////////
    135.         //LEFT
    136.         if(RotatingLeft)
    137.         {
    138.             if(t_airplane_180<180.0f)
    139.             {
    140.                 float t_rot=(SpeedBoost/10.0f)*SpeedBoost*Time.deltaTime;
    141.                 t_airplane_180+=t_rot;
    142.                 transform.Rotate(0.0f, t_rot, 0.0f);   
    143.             }
    144.             else
    145.             {
    146.                 FacingLeft=true;
    147.                 RotatingLeft=false;
    148.                 RotatingRight=false;                           
    149.                 float t_x_rot=  transform.rotation.eulerAngles.x;  
    150.                 float t_z_rot=  transform.rotation.eulerAngles.z;  
    151.                 if(!t_inverse_rotation)
    152.                 {
    153.                     transform.eulerAngles = new Vector3(t_x_rot,270.0f,0.0f);
    154.                 }
    155.                
    156.             }
    157.         }
    158.         ////////////
    159.         //RIGHT
    160.         if(RotatingRight)
    161.         {          
    162.             //////
    163.         }
    164.        
    165.     }
    166.  
    167. }
     
  4. yavadoo

    yavadoo

    Joined:
    Mar 24, 2012
    Posts:
    101
    Looks really good and like a lot of fun, I like the blobshadow if the plane comes close to the ground, looks realistic (maybe a little to dark if you come very close to the ground).
    First time I got a little confused when the plain went towards me, looked like you can also move in z-direction. But you cant, can you?

    Looks solid and professional, keep it up.
     
  5. deepboom

    deepboom

    Joined:
    Apr 29, 2012
    Posts:
    9
    yavadoo >> you cant move in Z , that is just for rotation, during the game you dont need to worry about it. I will tweak the shadow(going to my list) :)
    Thanks for the feedback.
     
  6. Torsh

    Torsh

    Joined:
    Sep 26, 2011
    Posts:
    553
    Nice game. I like the grass texturing and the background toward the bottom.
     
  7. Tobias J.

    Tobias J.

    Joined:
    Feb 21, 2012
    Posts:
    423
    Who are the nasty people putting balloons on your cows? Must be really evil or have some devious plan I think. Maybe you could bomb them before they put the balloons on them?

    Looks great!
     
  8. deepboom

    deepboom

    Joined:
    Apr 29, 2012
    Posts:
    9
  9. Km0nk3y

    Km0nk3y

    Joined:
    Apr 19, 2012
    Posts:
    70
    Clearly the aliens are trying to abduct all the cows. They just dont have the guts to land.
     
  10. deepboom

    deepboom

    Joined:
    Apr 29, 2012
    Posts:
    9
    Km0nk3y >> yes that was my first idea , but will try to think something more unusual , if you can say that in this case ...
     
  11. softwizz

    softwizz

    Joined:
    Mar 12, 2011
    Posts:
    793
    Thanks for some guidance on the plane control.

    I just noticed you have arrows pointing to where a cow is so no need for a radar, maybe a powerup could add a radar.

    Maybe it is alien clowns abducting the cows?

    Looks good and I wouldn't mind playing it.
     
  12. deepboom

    deepboom

    Joined:
    Apr 29, 2012
    Posts:
    9
    Softwizz>>
    It uses the locator HUD from asset store , works pretty well ... but I need to tweak it to use the uitoolkit to get less drawcalls.

    alien clowns?! funny ... never thought of that mix before :)

    Thanks,
     
  13. ivanzu

    ivanzu

    Joined:
    Nov 25, 2010
    Posts:
    2,065
    Nice game man but I think that plane should be a bit slower and bigger.
     
  14. deepboom

    deepboom

    Joined:
    Apr 29, 2012
    Posts:
    9
    ivanzu > the distance of the camera can be customizable by the player in the preferences , about the speed your right I didn't noticed because I play it many times , but the people that played it told the same, maybe I will do it customizable to ...
    Right now it has two speeds , normal and boost and I don't want to clutter the interface with another slider.
     
unityunity