Skip to content

Instantly share code, notes, and snippets.

View moon-goon's full-sized avatar
🎯
Focusing

moongoon moon-goon

🎯
Focusing
  • Canada
View GitHub Profile
@moon-goon
moon-goon / endcode.js
Last active January 28, 2016 19:08
Javascript / Encode and Decode using customized Regex
var encode = "abcdefg !@#$%^&*()"
var decode = "zyxwvut";
var swapValue = {
a:"z",
b:"y",
c:"x",
d:"w",
e:"v",
f:"u",
void OnCollisionExit(Collision collisionInfo) {
// not calling collisionInfo at this time but we can get the additional information using
// for example: collisionInfo.transform.name
// change player's color to red when collision is ended (not touching each other)
gameObject.GetComponent<Renderer>().material.color = Color.red;
}
void OnCollisionEnter(Collision target) {
// create a gameobject (a cube for this demo) name it "enemy"
// and your argument(target) is setup so that object can be collided with
if (target.gameObject.name == "enemy") {
// Change the player's color to green when collide occurs
gameObject.GetComponent<Renderer>().material.color = Color.green;
}
}
void Update () {
//Debug.Log(Input.GetAxis("Horizontal"));
transform.Translate(Input.GetAxis("Horizontal") * Time.deltaTime, 0f, Input.GetAxis("Vertical") * Time.deltaTime);
}