Skip to content
This repository has been archived by the owner on Aug 3, 2022. It is now read-only.

Commit

Permalink
Added Coins (to UI for now), and Leaves Particles
Browse files Browse the repository at this point in the history
  • Loading branch information
AndusDEV committed May 25, 2022
1 parent 9d5a117 commit 89fe284
Show file tree
Hide file tree
Showing 21 changed files with 5,940 additions and 625 deletions.
334 changes: 173 additions & 161 deletions Assets/Levels/TestLevel/TestLevel.unity

Large diffs are not rendered by default.

4,822 changes: 4,821 additions & 1 deletion Assets/Prefabs/Cameras.prefab

Large diffs are not rendered by default.

467 changes: 319 additions & 148 deletions Assets/Prefabs/Canvas'.prefab

Large diffs are not rendered by default.

74 changes: 2 additions & 72 deletions Assets/Prefabs/Player.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ GameObject:
- component: {fileID: 2325003724858187046}
- component: {fileID: 2325003724858187033}
- component: {fileID: 2325003724858187032}
- component: {fileID: 5368689100701675215}
m_Layer: 0
m_Name: Player
m_TagString: Player
Expand Down Expand Up @@ -173,9 +172,10 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
dialogueUI: {fileID: 0}
speedVar: 4.5
speedVar: 4.25
jumpForceVar: 10.5
extraJumpsValue: 1
dashDistance: 15
groundCheck: {fileID: 2325003724931805982}
checkRadius: 0.8
whatIsGround:
Expand Down Expand Up @@ -221,76 +221,6 @@ MonoBehaviour:
emptyHeart: {fileID: 5642012044021194823, guid: c4cd448e847ea2b4a9b3b7cb2029c7c7, type: 3}
damageTilemap: {fileID: 0}
timeThreshold: 0
--- !u!114 &5368689100701675215
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2325003724858187040}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 62899f850307741f2a39c98a8b639597, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Actions: {fileID: -944628639613478452, guid: 9d5d53c69469b5c4283cfff949361091, type: 3}
m_NotificationBehavior: 2
m_UIInputModule: {fileID: 0}
m_DeviceLostEvent:
m_PersistentCalls:
m_Calls: []
m_DeviceRegainedEvent:
m_PersistentCalls:
m_Calls: []
m_ControlsChangedEvent:
m_PersistentCalls:
m_Calls: []
m_ActionEvents:
- m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName:
m_MethodName:
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName:
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_ActionId: b75b061a-4da9-4810-b39d-7b43a6757dea
m_ActionName: Player/Move[/Keyboard/w,/Keyboard/upArrow,/Keyboard/a,/Keyboard/leftArrow,/Keyboard/d,/Keyboard/rightArrow]
- m_PersistentCalls:
m_Calls: []
m_ActionId: 84d24b1c-f18e-4d9d-8442-73078782ab7b
m_ActionName: Player/DebugKey[/Keyboard/backquote]
- m_PersistentCalls:
m_Calls: []
m_ActionId: a57531a7-94fd-4a8c-bb52-d76b0aa2d11c
m_ActionName: Player/Sprint[/Keyboard/leftShift]
- m_PersistentCalls:
m_Calls: []
m_ActionId: 7367c806-adba-45b2-b3e2-61168dafa72b
m_ActionName: Player/Jump[/Keyboard/w,/Keyboard/upArrow]
- m_PersistentCalls:
m_Calls: []
m_ActionId: bed77529-a4dd-469c-aaa3-0d4240078fa4
m_ActionName: Player/Interact[/Keyboard/e]
- m_PersistentCalls:
m_Calls: []
m_ActionId: 5ed07d80-b072-429a-af0e-bc5e42ebb2c7
m_ActionName: Player/ESCMenu[/Keyboard/escape]
- m_PersistentCalls:
m_Calls: []
m_ActionId: 43e33bfd-3a64-46e6-aea3-c6860c57688a
m_ActionName: Player/Mouse[/Mouse/leftButton,/DualShock4GamepadHID/select]
m_NeverAutoSwitchControlSchemes: 0
m_DefaultControlScheme:
m_DefaultActionMap: Player
m_SplitScreenIndex: -1
m_Camera: {fileID: 0}
--- !u!1 &2325003724862332049
GameObject:
m_ObjectHideFlags: 0
Expand Down
5 changes: 4 additions & 1 deletion Assets/Scripts/Debugging/DebugDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class DebugDisplay : MonoBehaviour {
// Player Pos
private GameObject playerObj;
private string playerPos;
private string dashStatus;

void Start() {
DebugText.gameObject.SetActive(false);
Expand All @@ -27,7 +28,9 @@ void Update() {
playerObj = GameObject.FindGameObjectWithTag("Player");
playerPos = ("X " + playerObj.transform.position.x + " Y " + playerObj.transform.position.y);

DebugText.text = ("FPS: " + frameRate.ToString() + "\nPos: " + playerPos);
dashStatus = ("Always Ready");

DebugText.text = ("FPS: " + frameRate.ToString() + "\nPos: " + playerPos + "\nDash: " + dashStatus);

time -= updateTime;
frameCount = 0;
Expand Down
8 changes: 8 additions & 0 deletions Assets/Scripts/Effects.meta

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

33 changes: 33 additions & 0 deletions Assets/Scripts/Effects/ParticleManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class ParticleManager : MonoBehaviour {
public ParticleSystem leafSystem;

public bool leavesParticle;

void Start() {
leafSystem = GetComponent<ParticleSystem>();
leavesParticle = false;
}

void Update() {
if (leavesParticle) {
leafSystem.Play();
} else {
leafSystem.Stop();
}
}

void ParticleEnabler(string name, bool status) {
if (name == "leaves") {
if (status) {
leavesParticle = true;
} else {
leavesParticle = false;
}
}
}
}
11 changes: 11 additions & 0 deletions Assets/Scripts/Effects/ParticleManager.cs.meta

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

34 changes: 34 additions & 0 deletions Assets/Scripts/Effects/UISpriteAnimator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class UISpriteAnimator : MonoBehaviour {

public Sprite[] sprites;
public int spritePerFrame = 6;
public bool loop = true;
public bool destroyOnEnd = false;

private int index = 0;
private Image image;
private int frame = 0;

void Awake() {
image = GetComponent<Image> ();
}

void Update () {
if (!ESCMenu.menuOpen) {
if (!loop && index == sprites.Length) return;
frame ++;
if (frame < spritePerFrame) return;
image.sprite = sprites [index];
frame = 0;
index ++;
if (index >= sprites.Length) {
if (loop) index = 0;
if (destroyOnEnd) Destroy (gameObject);
}
}
}
}
11 changes: 11 additions & 0 deletions Assets/Scripts/Effects/UISpriteAnimator.cs.meta

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

50 changes: 39 additions & 11 deletions Assets/Scripts/Player/Player.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Collections;
using UnityEngine;
using UnityEngine.InputSystem;

Expand All @@ -17,14 +18,16 @@ public class Player : MonoBehaviour {
public static bool canMove = true;
private float moveInput;
private bool jumpInput;
private bool jumpInputPad;
private bool facingRight = true;

private int extraJumps;
public int extraJumpsValue;
private int jumps;
public static float gravity = 2.0f;

public float dashDistance = 15f;
bool isDashing;

public static Rigidbody2D rb;
public static BoxCollider2D bc;
private Animator anim;
Expand Down Expand Up @@ -57,10 +60,13 @@ private void Update() {
isGrounded = Physics2D.OverlapCircle(groundCheck.position, checkRadius, whatIsGround);
rb.velocity = new Vector2(moveInput * speed, rb.velocity.y);
moveInput = Input.GetAxis("Horizontal");
jumpInput = (Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown("joystick button 0"));

if (!canMove) {
speed = 0f;
jumpForce = 0f;
} else if (isDashing) {
speed = (speedVar * 2);
} else {
speed = speedVar;
jumpForce = jumpForceVar;
Expand All @@ -70,7 +76,7 @@ private void Update() {
Flip();
}

if (isGrounded == true) {
if (isGrounded) {
extraJumps = extraJumpsValue;
}

Expand All @@ -82,18 +88,22 @@ private void Update() {
}

// More-Movement related stuff
if ((moveInput > 0f || moveInput < 0f) && canMove) {
anim.SetBool("moving", true);

if ( (Input.GetKey(KeyCode.LeftShift) || Input.GetKey("joystick button 4")) ) {
rb.velocity = new Vector2(moveInput * (speed * 1.55f), rb.velocity.y);
jumpForce = jumpForceVar * 1.05f;
// Movement
if (!isDashing) {
if ((moveInput > 0f || moveInput < 0f) && canMove) {
anim.SetBool("moving", true);

if ( (Input.GetKey(KeyCode.LeftShift) || Input.GetKey("joystick button 4")) ) {
rb.velocity = new Vector2(moveInput * (speed * 1.40f), rb.velocity.y);
jumpForce = jumpForceVar * 1.05f;
}
} else {
anim.SetBool("moving", false);
}
} else {
anim.SetBool("moving", false);
}

if ((Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown("joystick button 0"))) {
// Jumping
if (jumpInput) {
if (canMove && extraJumps > 0) {
rb.velocity = new Vector2(rb.velocity.x, jumpForce);
soundMan.PlaySoundEffect("jump");
Expand All @@ -104,6 +114,13 @@ private void Update() {
rb.velocity = new Vector2(rb.velocity.x, speed+5);
}
}

// Dashing
if ((Input.GetKeyDown(KeyCode.LeftControl) || Input.GetKeyDown("joystick button 5")) && moveInput > 0f) {
StartCoroutine(Dash(1f));
} else if ((Input.GetKeyDown(KeyCode.LeftControl) || Input.GetKeyDown("joystick button 5")) && moveInput < 0f) {
StartCoroutine(Dash(-1f));
}
}

private void Flip() {
Expand All @@ -116,6 +133,17 @@ private void Flip() {
}
}

private IEnumerator Dash(float direction) {
isDashing = true;
rb.velocity = new Vector2(rb.velocity.x, 0f);
rb.AddForce(new Vector2(dashDistance * direction, 0f), ForceMode2D.Impulse);
float gravity = rb.gravityScale;
rb.gravityScale = 0;
yield return new WaitForSeconds(0.4f);
isDashing = false;
rb.gravityScale = gravity;
}

void CreateDust() {
dust.Play();
}
Expand Down
Binary file added Assets/Sprites/Characters/Effects/Leaf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 89fe284

Please sign in to comment.