Skip to content

Commit

Permalink
Added glow to BBW, cleaned up some scripts
Browse files Browse the repository at this point in the history
I added a glow to BBW when he is able to jump (when LRRH is in contact
with him)
  • Loading branch information
ribbybibby committed Jan 24, 2015
1 parent 1dad3d0 commit df61e60
Show file tree
Hide file tree
Showing 27 changed files with 71 additions and 38 deletions.
8 changes: 1 addition & 7 deletions Assets/Axe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,7 @@ void Start ()
SoundManager play = GameObject.Find("SoundManager").gameObject.GetComponent<SoundManager>();
play.PlayWoodCutterAxe ();
}

// Update is called once per frame
void Update ()
{

}


void OnTriggerEnter2D(Collider2D other)
{
if(other.gameObject.layer == 12 || other.gameObject.layer == 13)
Expand Down
Binary file modified Assets/Objects_Characters/BBW/BBW1.prefab
Binary file not shown.
2 changes: 1 addition & 1 deletion Assets/Objects_Characters/BBW/BBW1.prefab.meta
100755 → 100644

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified Assets/Objects_Characters/BBW/BBW2.prefab
Binary file not shown.
86 changes: 61 additions & 25 deletions Assets/Objects_Characters/BBW/BBWController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public class BBWController : MonoBehaviour {
public bool facingRight; // Allows Melee System to tell which direction BBW is facing



//Used to load in the textures for the swap (left text for moving left / right text for moving right)
public Texture leftTexture;
public Texture rightTexture;
Expand All @@ -29,6 +28,10 @@ public class BBWController : MonoBehaviour {
private float airGravity; //Incremented value for x-axis movement while in the air
private float origGravity; //Original gravity of the character
private SoundManager play; // The sound manager
//private Transform[] findGlowTransform;
//private Transform glowTransform;
private GameObject[] findGlow;
private GameObject glow;


// At start we set the number of jumps performed since leaving the ground to 0
Expand All @@ -46,72 +49,103 @@ void Start ()

airMoves = 1;
origGravity = gameObject.rigidbody2D.gravityScale;

// Find the attached Glow object
glow = GameObject.Find ("Glow");
glow.renderer.enabled = false;
}

// Movement controls
void Update ()
{
// Make sure we still have the correct Glow object
glow = GameObject.Find ("Glow");

//Fix rotation every update
transform.eulerAngles = new Vector3(0,0,0);
//Debug.Log(Input.GetAxis("Horizontal_PLR1"));

if (gameObject.tag == "BBW") {
//We check the layer to make sure its player one (layer 12)
// If it is we let the pad controls work fine if its not we dont cause it's not player one
if (gameObject.layer == 12) {
//Move Right
if (Input.GetKey (moveRight) || Input.GetAxis ("Horizontal_PLR1") > 0) {
if (airMoves == 1) {
if (airMoves == 1)
{
transform.Translate (Vector2.right * speed * Time.deltaTime);
} else if (airMoves > 1) {
}
else if (airMoves > 1)
{
transform.Translate (Vector2.right * (speed / airMoves) * Time.deltaTime);
airMoves = airMoves + airMoveIncrement;
gameObject.rigidbody2D.gravityScale = gameObject.rigidbody2D.gravityScale + airGravityIncrement;
}


//Switch to Right Texture, position glow
GameObject.Find ("BBW").gameObject.GetComponent<Renderer> ().material.SetTexture ("_MainTex", rightTexture);
glow.transform.localPosition = new Vector3 (-0.1f, -0.039f, 0.2f);
facingRight = true;

}
//Move Left
// If BBW is in the air, start to limit movement
if (Input.GetKey (moveLeft) || Input.GetAxis ("Horizontal_PLR1") < 0) {
if (airMoves == 1) {
if (airMoves == 1)
{
transform.Translate (-Vector2.right * speed * Time.deltaTime);
} else if (airMoves > 1) {
}
else if (airMoves > 1)
{
transform.Translate (-Vector2.right * (speed / airMoves) * Time.deltaTime);
airMoves = airMoves + airMoveIncrement;
gameObject.rigidbody2D.gravityScale = gameObject.rigidbody2D.gravityScale + airGravityIncrement;
}


//Switch to Left Texture, position glow
GameObject.Find ("BBW").gameObject.GetComponent<Renderer> ().material.SetTexture ("_MainTex", leftTexture);
glow.transform.localPosition = new Vector3 (0.08f, -0.04f, 0.2f);
facingRight = false;
}
}else{
//END OF PLAYER 1 LAYER CHECK
if (gameObject.tag == "BBW") {
//Move Right
// If BBW is in the air, start to limit movement
if (Input.GetKey (moveRight)) {
if (airMoves == 1) {
if (airMoves == 1)
{
transform.Translate (Vector2.right * speed * Time.deltaTime);
} else if (airMoves > 1) {
}
else if (airMoves > 1)
{
transform.Translate (Vector2.right * (speed / airMoves) * Time.deltaTime);
airMoves = airMoves + airMoveIncrement;
gameObject.rigidbody2D.gravityScale = gameObject.rigidbody2D.gravityScale + airGravityIncrement;
}


//Switch to Right Texture, position glow
GameObject.Find ("BBW").gameObject.GetComponent<Renderer> ().material.SetTexture ("_MainTex", rightTexture);
glow.transform.localPosition = new Vector3 (-0.1f, -0.039f, 0.2f);
facingRight = true;

}
//Move Left
// If BBW is in the air, start to limit movement
if (Input.GetKey (moveLeft)) {
if (airMoves == 1) {
if (airMoves == 1)
{
transform.Translate (-Vector2.right * speed * Time.deltaTime);
} else if (airMoves > 1) {
}
else if (airMoves > 1)
{
transform.Translate (-Vector2.right * (speed / airMoves) * Time.deltaTime);
airMoves = airMoves + airMoveIncrement;
gameObject.rigidbody2D.gravityScale = gameObject.rigidbody2D.gravityScale + airGravityIncrement;
}


//Switch to Left Texture, position glow
GameObject.Find ("BBW").gameObject.GetComponent<Renderer> ().material.SetTexture ("_MainTex", leftTexture);
glow.transform.localPosition = new Vector3 (0.08f, -0.04f, 0.2f);
facingRight = false;
}
}
Expand All @@ -124,17 +158,18 @@ void OnTriggerEnter2D(Collider2D other)
{

if (other.gameObject.tag == "LRRHTrigger") {
if (gameObject.layer == 12) {

//Jump
if (Input.GetKeyDown (moveJump) || Input.GetButtonUp ("Jump")) {
if (jumpsMade < jumpLimit) {
play.PlayJumpBBW ();
rigidbody2D.AddForce (Vector2.up * jumpHeight);
jumpsMade++;
}
}
glow.renderer.enabled = true;
if (gameObject.layer == 12) {

//Jump
if (Input.GetKeyDown (moveJump) || Input.GetButtonUp ("Jump")) {
if (jumpsMade < jumpLimit) {
play.PlayJumpBBW ();
rigidbody2D.AddForce (Vector2.up * jumpHeight);
jumpsMade++;
}
}
}

//Jump
if (Input.GetKeyDown (moveJump)) {
Expand All @@ -160,6 +195,7 @@ void OnTriggerStay2D(Collider2D other)

if (other.gameObject.tag == "LRRHTrigger")
{
glow.renderer.enabled = true;
if (gameObject.layer == 12)
{
//Jump
Expand Down Expand Up @@ -190,7 +226,7 @@ void OnTriggerStay2D(Collider2D other)

void OnTriggerExit2D(Collider2D other)
{

glow.renderer.enabled = false;
if (other.gameObject.tag == "LRRHTrigger")
{
if (gameObject.layer == 12)
Expand Down
Binary file modified Assets/Objects_Characters/Pickup/PickUp.prefab
Binary file not shown.
Binary file modified Assets/Scenes/1.unity
Binary file not shown.
Binary file modified Library/AssetServerCacheV3
Binary file not shown.
Binary file modified Library/CurrentLayout.dwlt
Binary file not shown.
Binary file modified Library/CurrentMaximizeLayout.dwlt
Binary file not shown.
Binary file modified Library/ScriptAssemblies/Assembly-CSharp-Editor.dll
Binary file not shown.
Binary file modified Library/ScriptAssemblies/Assembly-CSharp-Editor.dll.mdb
Binary file not shown.
Binary file modified Library/ScriptAssemblies/Assembly-CSharp.dll
Binary file not shown.
Binary file modified Library/ScriptAssemblies/Assembly-CSharp.dll.mdb
Binary file not shown.
Binary file modified Library/assetDatabase3
Binary file not shown.
Binary file modified Library/expandedItems
Binary file not shown.
Binary file modified Library/guidmapper
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Library/metadata/49/491c7d77f986244fb9e96434c4e82dae
Binary file not shown.
Binary file modified Library/metadata/70/7068d080e9d2e4a2b93a0e0c3a934f2c
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion LudumDare31-csharp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
GlobalSection(MonoDevelopProperties) = preSolution
=======
GlobalSection(MonoDevelopProperties) = preSolution
>>>>>>> Stashed changes
Expand Down
2 changes: 1 addition & 1 deletion LudumDare31.sln
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
GlobalSection(MonoDevelopProperties) = preSolution
=======
GlobalSection(MonoDevelopProperties) = preSolution
>>>>>>> Stashed changes
Expand Down
9 changes: 6 additions & 3 deletions LudumDare31.userprefs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<Properties>
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" PreferredExecutionTarget="MonoDevelop.Default" />
<MonoDevelop.Ide.Workbench ActiveDocument="Assets/Objects_Characters/Cat/CatMovement.cs">
<MonoDevelop.Ide.Workbench ActiveDocument="Assets/Objects_Characters/SoundManager/SoundManager.cs">
<Files>
<File FileName="Assets/Objects_Characters/Enemy1/Scripts/EnemyReceiver.cs" Line="40" Column="79" />
<File FileName="Assets/Objects_Characters/Cat/CatMovement.cs" Line="19" Column="63" />
<File FileName="Assets/Objects_Characters/SoundManager/SoundManager.cs" Line="39" Column="15" />
<File FileName="Assets/Objects_Characters/Pickup/PickUpBehaviour.cs" Line="30" Column="1" />
<File FileName="Assets/Objects_Characters/Witch/WitchController.cs" Line="152" Column="3" />
<File FileName="Assets/Objects_Characters/Spawn/SpawnController.cs" Line="1" Column="1" />
<File FileName="Assets/Axe.cs" Line="12" Column="3" />
</Files>
</MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.DebuggingService.Breakpoints>
Expand Down
Binary file modified ProjectSettings/TagManager.asset
Binary file not shown.

0 comments on commit df61e60

Please sign in to comment.