Skip to content

Commit

Permalink
Shuriken
Browse files Browse the repository at this point in the history
Shuriken
  • Loading branch information
aps16104 committed Apr 21, 2020
1 parent 842592e commit 538d80a
Show file tree
Hide file tree
Showing 9 changed files with 485 additions and 230 deletions.
7 changes: 3 additions & 4 deletions Platformer/Assets/Prefabs/Bullet.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 776097286453626797}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -12.0997, y: -3.6982, z: -11.903397}
m_LocalScale: {x: 0.2274377, y: 0.41128823, z: 1}
m_LocalPosition: {x: -12.29, y: -2.211, z: -11.903397}
m_LocalScale: {x: 0.02429194, y: 0.02429194, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
Expand Down Expand Up @@ -71,7 +71,7 @@ SpriteRenderer:
m_SortingLayerID: -1143351675
m_SortingLayer: 3
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 0cc984826de43774b8b2676e287482ea, type: 3}
m_Sprite: {fileID: 21300000, guid: d42206453d3eb9c4c9473d5a8d2aa59f, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
Expand Down Expand Up @@ -132,5 +132,4 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
speed: 15
damage: 25
rb: {fileID: 2657745054146267846}
3 changes: 2 additions & 1 deletion Platformer/Assets/Scripts/Level 1/Bullet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ public class Bullet : MonoBehaviour
void Start()
{
rb.velocity = transform.right * speed;
}

}

private void OnTriggerEnter2D(Collider2D other)
{
Expand Down
24 changes: 22 additions & 2 deletions Platformer/Assets/Scripts/Level 1/Weapon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ public class Weapon : MonoBehaviour
{
public Transform firePoint; //where player is shooting from
public GameObject bulletPrefab;
void Update()
public int shots;

void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
Expand All @@ -16,6 +18,24 @@ void Update()

void Shoot()
{
Instantiate(bulletPrefab, firePoint.position, firePoint.rotation);
if (shots > 0)
{
Instantiate(bulletPrefab, firePoint.position, firePoint.rotation);
shots = shots - 1;
}
else
{
return;
}
}

void OnTriggerEnter2D(Collider2D other) //Pickups
{
if (other.gameObject.CompareTag("NinjaStar")) //If you got the key
{
other.gameObject.SetActive(false); //Star Dissapears
shots = shots + 1;

}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

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

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

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

Loading

0 comments on commit 538d80a

Please sign in to comment.