Skip to content

Commit

Permalink
Bewes Knees
Browse files Browse the repository at this point in the history
the bees have knees?
  • Loading branch information
aps16104 committed May 5, 2020
1 parent 4d38e1d commit d864e80
Show file tree
Hide file tree
Showing 17 changed files with 436 additions and 202 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using UnityEngine;
using UnityEngine.UI;

public class Bee_Enemy : MonoBehaviour
public class Enemy1 : MonoBehaviour
{

public Animator animator;
Expand Down Expand Up @@ -50,13 +50,11 @@ public void TakeDamage(int damage)
slider.value = CalculateHealth();

//Hurt Animation
SoundManagerScript.PlaySound("GhostHurt");
animator.SetTrigger("Hurt");
SoundManagerScript.PlaySound("BeeHit");
if (currentHealth <= 0)
{
Instantiate(score, new Vector3(ghost.position.x, ghost.position.y, ghost.position.z), Quaternion.identity);

animator.SetBool("IsDead", true);
Die();
}
}
Expand All @@ -75,7 +73,7 @@ private void OnTriggerEnter2D(Collider2D other)
TakeDamage(Shurikendamage);
healthBarUI.SetActive(true);
slider.value = CalculateHealth();
SoundManagerScript.PlaySound("GhostHurt");
SoundManagerScript.PlaySound("BeeHit");
}

}
Expand Down

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

57 changes: 29 additions & 28 deletions Platformer/Assets/Prefabs/Bee.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: -6.38, y: 9.179993}
m_AnchoredPosition: {x: -6.38, y: 8.846}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0, y: 0}
--- !u!114 &6746244900469705723
Expand Down Expand Up @@ -144,7 +144,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.17372729, g: 0.6037736, b: 0.22807202, a: 1}
m_Color: {r: 1, g: 0.8000001, b: 0, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
Expand Down Expand Up @@ -279,11 +279,11 @@ GameObject:
- component: {fileID: 6134100177009422160}
- component: {fileID: 6134100177009422162}
- component: {fileID: 7922802657477513153}
- component: {fileID: 5684347372251890869}
- component: {fileID: 6134100177009422175}
- component: {fileID: 1130337972426661562}
m_Layer: 11
m_Name: Bee 1
m_TagString: Enemy
m_Name: Bee
m_TagString: Bee
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
Expand Down Expand Up @@ -385,7 +385,7 @@ BoxCollider2D:
m_IsTrigger: 1
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: -0.009844661, y: 0.013730824}
m_Offset: {x: -0.009844661, y: -0.0030899048}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
Expand All @@ -396,7 +396,7 @@ BoxCollider2D:
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 0.5493791, y: 0.75746167}
m_Size: {x: 0.5493791, y: 0.5402832}
m_EdgeRadius: 0
--- !u!114 &7922802657477513153
MonoBehaviour:
Expand All @@ -412,27 +412,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
moveRight: 1
Ghost: {fileID: 6134100177009422172}
--- !u!114 &5684347372251890869
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6134100177009422172}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f44ee1a21b2fd0240858d7f7c375f231, type: 3}
m_Name:
m_EditorClassIdentifier:
animator: {fileID: 6134100177009422175}
maxHealth: 20
currentHealth: 0
healthBarUI: {fileID: 8924187236842143802}
slider: {fileID: 6746244900469705723}
enemie: {fileID: 6134100177009422172}
ghost: {fileID: 6134100177009422167}
Shurikendamage: 10
score: {fileID: 6831754131110099708, guid: e170a43bc37e278468fc83ed09f780c2, type: 3}
mySpriteRenderer: {fileID: 6134100177009422160}
--- !u!95 &6134100177009422175
Animator:
serializedVersion: 3
Expand All @@ -452,6 +432,27 @@ Animator:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0
--- !u!114 &1130337972426661562
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6134100177009422172}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9657cc9d41c150d4aaa7464b0f0c1f71, type: 3}
m_Name:
m_EditorClassIdentifier:
animator: {fileID: 6134100177009422175}
maxHealth: 24
currentHealth: 0
healthBarUI: {fileID: 8924187236842143802}
slider: {fileID: 6746244900469705723}
enemie: {fileID: 6134100177009422172}
ghost: {fileID: 6134100177009422167}
Shurikendamage: 10
score: {fileID: 6831754131110099708, guid: e170a43bc37e278468fc83ed09f780c2, type: 3}
--- !u!1 &6804663626293780139
GameObject:
m_ObjectHideFlags: 0
Expand Down
2 changes: 1 addition & 1 deletion Platformer/Assets/Prefabs/ghost_normal 1.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: feb60d963acb6e74db4f39b374c55970, type: 3}
m_Name:
m_EditorClassIdentifier:
speed: 1
moveRight: 1
Ghost: {fileID: 2000275865591280230}
mySpriteRenderer: {fileID: 2000275865591280234}
--- !u!1 &3835886914462375168
GameObject:
m_ObjectHideFlags: 0
Expand Down
Binary file added Platformer/Assets/Resources/BeeHit.wav
Binary file not shown.
22 changes: 22 additions & 0 deletions Platformer/Assets/Resources/BeeHit.wav.meta

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

Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,34 @@ public class EnemyPatrol : MonoBehaviour
public bool moveRight;
public static float speed;
public GameObject Ghost;
public SpriteRenderer mySpriteRenderer;

void Start()
{
speed = (Random.Range(1f, 1.5f));
Rigidbody2D rigidbody = GetComponent<Rigidbody2D>();
rigidbody.velocity = transform.right * speed;
mySpriteRenderer = GetComponent<SpriteRenderer>();
}

void Update()
{
if (moveRight)
{
transform.Translate(2 * Time.deltaTime * speed, 0, 0);
transform.localScale =new Vector3(-1, 1,1);
if (mySpriteRenderer != null)
{
// flip the sprite
mySpriteRenderer.flipX = true;
}
}

if (moveRight == false)
{

transform.Translate(2 * Time.deltaTime * -(speed*2), 0, 0);
transform.localScale = new Vector3(1, 1,1);

mySpriteRenderer.flipX = false;
}
}

Expand Down
File renamed without changes.
8 changes: 8 additions & 0 deletions Platformer/Assets/Scripts/Player&Enemy/Bullet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ private void OnTriggerEnter2D(Collider2D other)
{
Destroy(gameObject);

}

if (other.gameObject.CompareTag("Bee"))
{
Destroy(gameObject);
SoundManagerScript.PlaySound("BeeHit");


}
if (other.gameObject.CompareTag("Wall"))
{
Expand Down
11 changes: 10 additions & 1 deletion Platformer/Assets/Scripts/Player&Enemy/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,21 @@ void OnTriggerEnter2D(Collider2D other) //Pickups

if (other.gameObject.CompareTag("Enemy")) //take damage
{

TakeDamage(20);
score = score - 10;
}

if (other.gameObject.CompareTag("Bee")) //take damage
{

TakeDamage(10);
score = score - 10;
}

if (other.gameObject.CompareTag("Spikes")) //take damage
{

TakeDamage(10);
score = score - 10;

Expand Down Expand Up @@ -322,7 +331,7 @@ void OnTriggerEnter2D(Collider2D other) //Pickups
dialogText.text = "The Katana is very powerful\n" +"The Shurikens are very fast\n"+"Be wise with what you use";
}

if (other.gameObject.CompareTag("Sign"))
if (other.gameObject.CompareTag("Sign4"))
{
dialogBox.SetActive(true);
dialogText.text = "These forests are infested\n" + "Clear it to keep your village safe\n" + "Almost Home..";
Expand Down
3 changes: 2 additions & 1 deletion Platformer/Assets/Scripts/Player&Enemy/PlayerInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ void Update()

Vector2 directionalInput = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical")); //
player.SetDirectionalInput(directionalInput); //pass in directional input
//set up attack positions so on turn the sword circle was in correct position
attackPoint.position = new Vector3(attackPoint.position.x, attackPoint.position.y, attackPoint.position.z);
leftattackPoint.position = new Vector3(leftattackPoint.position.x, leftattackPoint.position.y, attackPoint.position.z);
rightattackPoint.position = new Vector3(rightattackPoint.position.x, rightattackPoint.position.y, attackPoint.position.z);
Expand Down Expand Up @@ -75,7 +76,7 @@ void Update()
}


if (Input.GetKeyDown(KeyCode.Space) || Input.GetKeyDown(KeyCode.W)) //space down
if (Input.GetKeyDown(KeyCode.Space)) //space down
{
SoundManagerScript.PlaySound("Jump");

Expand Down
6 changes: 6 additions & 0 deletions Platformer/Assets/Scripts/Player&Enemy/Weapon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@ void Attack()
Collider2D[] hitEnemies = Physics2D.OverlapCircleAll(attackPoint.position, attackRange, enemyLayers );
foreach(Collider2D enemy in hitEnemies)
{
//was getting errors until this, helped recognize layers or something idk
if(enemy.CompareTag("Bee"))
{
enemy.GetComponent<Enemy1>().TakeDamage(attackDamage);
}
enemy.GetComponent<Enemy>().TakeDamage(attackDamage);

Debug.Log("We hit" + enemy.name);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

public class SoundManagerScript : MonoBehaviour
{
public static AudioClip Collectsound, Jumpsound, Swordsound, Diesound, Throwsound, Hurtsound, Heartsound, GhsotHurtSound, Keysound, teleportSound, evilLaughSound;
public static AudioClip Collectsound, Jumpsound, Swordsound, Diesound, Throwsound, Hurtsound, Heartsound, GhsotHurtSound, Keysound, teleportSound, evilLaughSound, BeeHitSound;
static AudioSource audioSrc;

public AudioClip otherClip;
Expand All @@ -24,6 +24,8 @@ void Start()
Keysound = Resources.Load<AudioClip>("Key");
teleportSound = Resources.Load<AudioClip>("teleport");
evilLaughSound = Resources.Load<AudioClip>("Evil Laugh");
BeeHitSound = Resources.Load<AudioClip>("BeeHit");



audioSrc = GetComponent<AudioSource>();
Expand Down Expand Up @@ -70,9 +72,8 @@ public static void PlaySound(string clip)
case "teleport":
audioSrc.PlayOneShot(teleportSound);
break;

case "Evil Laugh":
audioSrc.PlayOneShot(evilLaughSound);
case "BeeHit":
audioSrc.PlayOneShot(BeeHitSound);
break;

}
Expand Down
24 changes: 23 additions & 1 deletion Platformer/Assets/World Build/Enemies/Enemy sprites/bee.png.meta

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

Loading

0 comments on commit d864e80

Please sign in to comment.