This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma strict | |
// access from other scripts like GameData.numGrabbed++ | |
static var numGrabbed : int = 0; | |
static var numMissed : int = 0; | |
static function DisplayScore () { | |
Debug.Log("Grabbed: " + numGrabbed + " Missed: " + numMissed); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma strict | |
public var gObj : GameObject; | |
function Start () { | |
InvokeRepeating("CreateRandom", 0, 4); | |
} | |
function CreateRandom () | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma strict | |
public var hitTag : string = "Ground"; | |
function OnCollisionEnter2D (other : Collision2D) | |
{ | |
if (other.gameObject.CompareTag(hitTag)) | |
{ | |
GameData.numMissed++; | |
GameData.DisplayScore(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma strict | |
function OnMouseDown () | |
{ | |
if (gameObject.transform.position.y > -2 && gameObject.transform.position.y < 4) | |
{ | |
GameData.numGrabbed++; | |
GameData.DisplayScore(); | |
Destroy(gameObject); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma strict | |
public var pickupValue : int = 5; | |
function OnTriggerEnter2D(other : Collider2D) | |
{ | |
var gObj : GameObject = other.gameObject; | |
var clip : AudioClip; | |
if (gObj.CompareTag("Player")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function coinToss(weighted) | |
local w = weighted or 50 | |
return math.random() <= w/100 | |
end |
NewerOlder