Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Collision_Screen_Border.js
- // Date : 05/12/2012
- // Time : 10:54
- // Author : Christopher Cullen
- // Description :
- // This Script acts as a border for the game, if the object go's passed
- // the variable it will play an Aduio file to warn the user.
- // These variable declare the "Border" of the screen.
- public var yMax : float = 5.4;
- public var yMin : float = -3.5;
- public var xMax : float = 9.52;
- public var xMin : float = -9.52;
- // function Update ()
- // this function is responsible for handling the "border", if an object
- // goes passed the "Border".
- function Update ()
- {
- if(transform.localPosition.y >= yMax)
- {
- PlayAudio();
- }
- if(transform.localPosition.y <= yMin)
- {
- PlayAudio();
- }
- if(transform.localPosition.x >= xMax)
- {
- PlayAudio();
- }
- if(transform.localPosition.x <= xMin)
- {
- PlayAudio();
- }
- }
- // function PlayAudio()
- // This function is responsible for playing Audio.
- function PlayAudio()
- {
- audio.Play();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement