Summer Camp > Unity Game > pong -0

July 10, 2012   ·   0 Comments

using UnityEngine;
using System.Collections;

public class control : MonoBehaviour {
	public GameObject m_gameoject;
	// Use this for initialization
	void Start () {
	
	}
	
	void Update () {
	  float translation = Input.GetAxis("Horizontal") ;
       transform.Translate(translation, 0, 0);
		
		
		if (Input.GetButtonUp("Fire1") ) 
        {
			
			m_gameoject.rigidbody.AddForce (Vector3.up * 300);
        }
	}

void OnCollisionEnter (Collision other ) {
   other.rigidbody.AddForce (Vector3.up * 300);
	}
}

shareShare on FacebookShare on Google+Share on LinkedInEmail this to someonePrint this pageBuffer this pageDigg thisFlattr the authorShare on RedditPin on PinterestShare on StumbleUponShare on TumblrTweet about this on Twitter

By


Readers Comments (0)


You must be logged in to post a comment.

PowenKo’s Online Store

powenko_arduinoBook
Unity3D4

Amazon

adsbygoogle

Recent Posts

Categories

Amazon