From baf39e0e05808aaf16d6f7f8910fcb1e8de1736c Mon Sep 17 00:00:00 2001 From: Neil Kollack Date: Sat, 23 Apr 2022 22:08:26 -0500 Subject: fix: implement enemy jump, air whip, player fb --- Assets/Prefabs/Enemies/Zombie.prefab | 41 +++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) (limited to 'Assets/Prefabs/Enemies/Zombie.prefab') diff --git a/Assets/Prefabs/Enemies/Zombie.prefab b/Assets/Prefabs/Enemies/Zombie.prefab index 3725290..bad8ee7 100644 --- a/Assets/Prefabs/Enemies/Zombie.prefab +++ b/Assets/Prefabs/Enemies/Zombie.prefab @@ -1,5 +1,36 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &1617335577187073219 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8619667157834013351} + m_Layer: 10 + m_Name: GroundPoint (1) + m_TagString: Untagged + m_Icon: {fileID: 7866945982896999795, guid: 0000000000000000d000000000000000, type: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8619667157834013351 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1617335577187073219} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -0.251, y: -0.499, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 199732719703436395} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &4799600927363337844 GameObject: m_ObjectHideFlags: 0 @@ -35,6 +66,7 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 2602158014784719401} + - {fileID: 8619667157834013351} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -130,7 +162,10 @@ MonoBehaviour: maxJumps: 1 jumpForce: 500 damage: 0 - groundCheckPoint: {fileID: 2602158014784719401} + groundCheckPoint1: {fileID: 0} + groundCheckPoint2: {fileID: 0} + invulnTime: 0 + hangTime: 0 stats: maxHealth: 0 speedMultiplier: 0 @@ -308,7 +343,7 @@ GameObject: m_Layer: 10 m_Name: GroundPoint m_TagString: Untagged - m_Icon: {fileID: 0} + m_Icon: {fileID: 7866945982896999795, guid: 0000000000000000d000000000000000, type: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 @@ -320,7 +355,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 8191793094342821551} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -0.001, y: -0.499, z: 0} + m_LocalPosition: {x: 0.049000002, y: -0.499, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] -- cgit v1.2.3-70-g09d2 From 977086919ba3fae104153f79883e7a2347fac034 Mon Sep 17 00:00:00 2001 From: Neil Kollack Date: Sun, 24 Apr 2022 15:58:51 -0500 Subject: fix: better swing, Actor Force move, respawn sound --- Assets/Prefabs/Boulder.prefab | 4 +-- Assets/Prefabs/Enemies/Mummy.prefab | 6 ++-- Assets/Prefabs/Enemies/Zombie.prefab | 6 ++-- Assets/Prefabs/Player.prefab | 4 ++- Assets/Scenes/Jungle.unity | 16 +++++++++++ Assets/Scripts/Actors/Actor.cs | 55 ++++++++++++++++++++++++++++++------ Assets/Scripts/Actors/Player.cs | 2 ++ Assets/Scripts/Core/Stats.cs | 3 ++ Assets/Scripts/RespawnPoint.cs | 4 ++- 9 files changed, 84 insertions(+), 16 deletions(-) (limited to 'Assets/Prefabs/Enemies/Zombie.prefab') diff --git a/Assets/Prefabs/Boulder.prefab b/Assets/Prefabs/Boulder.prefab index 8298a01..a32eba5 100644 --- a/Assets/Prefabs/Boulder.prefab +++ b/Assets/Prefabs/Boulder.prefab @@ -137,8 +137,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 760b14f92dafdd34381066ba181a1f93, type: 3} m_Name: m_EditorClassIdentifier: - speed: 22 - maxSpeed: 10 + speed: 25 + maxSpeed: 20 --- !u!58 &7071841513841830746 CircleCollider2D: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/Enemies/Mummy.prefab b/Assets/Prefabs/Enemies/Mummy.prefab index 6f37abd..fc3c8e5 100644 --- a/Assets/Prefabs/Enemies/Mummy.prefab +++ b/Assets/Prefabs/Enemies/Mummy.prefab @@ -159,16 +159,18 @@ MonoBehaviour: baseStats: maxHealth: 3 speedMultiplier: 1 + maxSpeed: 10 maxJumps: 1 jumpForce: 500 damage: 0 - groundCheckPoint1: {fileID: 0} - groundCheckPoint2: {fileID: 0} + groundCheckPoint1: {fileID: 8919320863032976505} + groundCheckPoint2: {fileID: 3262404053825753980} invulnTime: 0 hangTime: 0 stats: maxHealth: 0 speedMultiplier: 0 + maxSpeed: 0 maxJumps: 0 jumpForce: 0 damage: 0 diff --git a/Assets/Prefabs/Enemies/Zombie.prefab b/Assets/Prefabs/Enemies/Zombie.prefab index bad8ee7..fe4e2f3 100644 --- a/Assets/Prefabs/Enemies/Zombie.prefab +++ b/Assets/Prefabs/Enemies/Zombie.prefab @@ -159,16 +159,18 @@ MonoBehaviour: baseStats: maxHealth: 3 speedMultiplier: 1 + maxSpeed: 10 maxJumps: 1 jumpForce: 500 damage: 0 - groundCheckPoint1: {fileID: 0} - groundCheckPoint2: {fileID: 0} + groundCheckPoint1: {fileID: 2602158014784719401} + groundCheckPoint2: {fileID: 8619667157834013351} invulnTime: 0 hangTime: 0 stats: maxHealth: 0 speedMultiplier: 0 + maxSpeed: 0 maxJumps: 0 jumpForce: 0 damage: 0 diff --git a/Assets/Prefabs/Player.prefab b/Assets/Prefabs/Player.prefab index 0fa27c6..d955ce6 100644 --- a/Assets/Prefabs/Player.prefab +++ b/Assets/Prefabs/Player.prefab @@ -314,7 +314,8 @@ MonoBehaviour: gravityScale: 5 baseStats: maxHealth: 3 - speedMultiplier: 2 + speedMultiplier: 1 + maxSpeed: 25 maxJumps: 1 jumpForce: 1200 damage: 0 @@ -325,6 +326,7 @@ MonoBehaviour: stats: maxHealth: 0 speedMultiplier: 0 + maxSpeed: 0 maxJumps: 0 jumpForce: 0 damage: 0 diff --git a/Assets/Scenes/Jungle.unity b/Assets/Scenes/Jungle.unity index 8f52001..2f6721b 100644 --- a/Assets/Scenes/Jungle.unity +++ b/Assets/Scenes/Jungle.unity @@ -211394,6 +211394,7 @@ MonoBehaviour: baseStats: maxHealth: 3 speedMultiplier: 1 + maxSpeed: 20 maxJumps: 1 jumpForce: 500 damage: 0 @@ -211404,6 +211405,7 @@ MonoBehaviour: stats: maxHealth: 0 speedMultiplier: 0 + maxSpeed: 0 maxJumps: 0 jumpForce: 0 damage: 0 @@ -438566,6 +438568,10 @@ PrefabInstance: propertyPath: hearts.Array.data[2] value: objectReference: {fileID: 2019698001} + - target: {fileID: 2776418409611166769, guid: b2169aaeb9a0e4542b1fb9d601bcc4b2, type: 3} + propertyPath: m_LocalPosition.x + value: -0.5 + objectReference: {fileID: 0} - target: {fileID: 2776418409999972307, guid: b2169aaeb9a0e4542b1fb9d601bcc4b2, type: 3} propertyPath: m_RootOrder value: 4 @@ -438614,6 +438620,10 @@ PrefabInstance: propertyPath: m_Name value: Player objectReference: {fileID: 0} + - target: {fileID: 5336306221325820075, guid: b2169aaeb9a0e4542b1fb9d601bcc4b2, type: 3} + propertyPath: m_LocalPosition.x + value: 0.5 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: b2169aaeb9a0e4542b1fb9d601bcc4b2, type: 3} --- !u!114 &7434619225285215647 @@ -438632,6 +438642,7 @@ MonoBehaviour: baseStats: maxHealth: 3 speedMultiplier: 1 + maxSpeed: 20 maxJumps: 1 jumpForce: 500 damage: 0 @@ -438642,6 +438653,7 @@ MonoBehaviour: stats: maxHealth: 0 speedMultiplier: 0 + maxSpeed: 0 maxJumps: 0 jumpForce: 0 damage: 0 @@ -438662,6 +438674,7 @@ MonoBehaviour: baseStats: maxHealth: 3 speedMultiplier: 1 + maxSpeed: 20 maxJumps: 1 jumpForce: 500 damage: 0 @@ -438672,6 +438685,7 @@ MonoBehaviour: stats: maxHealth: 0 speedMultiplier: 0 + maxSpeed: 0 maxJumps: 0 jumpForce: 0 damage: 0 @@ -439167,6 +439181,7 @@ MonoBehaviour: baseStats: maxHealth: 3 speedMultiplier: 1 + maxSpeed: 20 maxJumps: 1 jumpForce: 500 damage: 0 @@ -439177,6 +439192,7 @@ MonoBehaviour: stats: maxHealth: 0 speedMultiplier: 0 + maxSpeed: 0 maxJumps: 0 jumpForce: 0 damage: 0 diff --git a/Assets/Scripts/Actors/Actor.cs b/Assets/Scripts/Actors/Actor.cs index eb8185e..10b9a36 100644 --- a/Assets/Scripts/Actors/Actor.cs +++ b/Assets/Scripts/Actors/Actor.cs @@ -33,6 +33,7 @@ namespace MontanaJohns.Actors protected Vector2 acceleration; protected bool invuln; protected float hangCount; + protected float previousInput; public Stats stats; public int health; @@ -71,10 +72,32 @@ namespace MontanaJohns.Actors } } - public virtual void Move(float input) + public virtual void Move(float input, float maxSpeedModifier = 0f) { - var target = new Vector2(input * stats.speedMultiplier * 10, _rigidBody.velocity.y); - _rigidBody.velocity = Vector2.SmoothDamp(_rigidBody.velocity, target, ref acceleration, .05f); + + + var maxSpeed = stats.maxSpeed + maxSpeedModifier; + _rigidBody.AddForce(new Vector2(input * stats.speedMultiplier * 10, 0)); + + if (!isGrappling) + { + if (input == 0 || input < 0 && previousInput > 0 || input > 0 && previousInput < 0) + { + var target = new Vector2(0, _rigidBody.velocity.y); + _rigidBody.velocity = Vector2.SmoothDamp(_rigidBody.velocity, target, ref acceleration, .05f); + } + } + + if (input < 0 && Mathf.Abs(_rigidBody.velocity.x) > maxSpeed) + _rigidBody.velocity = new Vector2(-maxSpeed, _rigidBody.velocity.y); + else if (input > 0 && Mathf.Abs(_rigidBody.velocity.x) > maxSpeed) + _rigidBody.velocity = new Vector2(maxSpeed, _rigidBody.velocity.y); + + if (IsGrounded() && input == 0) + _rigidBody.gravityScale = 0f; + else + _rigidBody.gravityScale = gravityScale; + _animator.SetBool("moving", Mathf.Abs(_rigidBody.velocity.x) > 1); isMoving = Mathf.Abs(_rigidBody.velocity.x) > 1; @@ -94,18 +117,34 @@ namespace MontanaJohns.Actors transform.GetChild(i).rotation = rot; } } + previousInput = input; + } + public virtual void MoveY(float inputX, float inputY, float doNotExceed, float maxSpeedModifier = 0f) + { + if(_rigidBody.position.y <= doNotExceed) + { + var maxSpeed = stats.maxSpeed + maxSpeedModifier; + _rigidBody.AddForce(new Vector2(0, inputY * stats.speedMultiplier * 10)); + + if (inputY < 0 && Mathf.Abs(_rigidBody.velocity.x) > maxSpeed) + _rigidBody.velocity = new Vector2(-maxSpeed, _rigidBody.velocity.y); + else if (inputY > 0 && Mathf.Abs(_rigidBody.velocity.x) > maxSpeed) + _rigidBody.velocity = new Vector2(maxSpeed, _rigidBody.velocity.y); + } } - public virtual void MoveY(float input) + + public virtual bool IsGrounded() { - var target = new Vector2(_rigidBody.velocity.x, input * stats.speedMultiplier * 10); - _rigidBody.velocity = Vector2.SmoothDamp(_rigidBody.velocity, target, ref acceleration, .05f); + if (Physics2D.OverlapCircle(groundCheckPoint1.position, 0.2f, groundLayers) || Physics2D.OverlapCircle(groundCheckPoint2.position, 0.2f, groundLayers)) + return true; + return false; } public virtual void Jump() { if (isGrappling) Use(); - if(Physics2D.OverlapCircle(groundCheckPoint1.position, 0.2f, groundLayers) || Physics2D.OverlapCircle(groundCheckPoint2.position, 0.2f, groundLayers)) + if(IsGrounded()) { jumpCount = stats.maxJumps; hangCount = hangTime; @@ -161,7 +200,7 @@ namespace MontanaJohns.Actors public virtual void Grapple(float xInput, float yInput, Vector2 grapplePoint) { Move(xInput); - MoveY(yInput); + MoveY(xInput, yInput, grapplePoint.y); } public virtual void TakeDamage(int damage) diff --git a/Assets/Scripts/Actors/Player.cs b/Assets/Scripts/Actors/Player.cs index f4edeef..0973c5a 100644 --- a/Assets/Scripts/Actors/Player.cs +++ b/Assets/Scripts/Actors/Player.cs @@ -66,6 +66,8 @@ namespace MontanaJohns.Actors if(health <= 0) { MainCamera.GetComponent().ResetLevel(); + if (isGrappling) + Use(); ResetStats(); health = stats.maxHealth; transform.position = spawnPoint; diff --git a/Assets/Scripts/Core/Stats.cs b/Assets/Scripts/Core/Stats.cs index aac6fe7..29c1804 100644 --- a/Assets/Scripts/Core/Stats.cs +++ b/Assets/Scripts/Core/Stats.cs @@ -22,6 +22,7 @@ namespace MontanaJohns.Core { [SerializeField] public int maxHealth; [SerializeField] public float speedMultiplier; + [SerializeField] public float maxSpeed; [SerializeField] public int maxJumps; [SerializeField] public float jumpForce; [SerializeField] public int damage; @@ -35,6 +36,7 @@ namespace MontanaJohns.Core maxJumps = x.maxJumps + y.maxJumps, jumpForce = x.jumpForce + y.jumpForce, damage = x.damage + y.damage, + maxSpeed = x.maxSpeed + y.maxSpeed, }; } @@ -44,6 +46,7 @@ namespace MontanaJohns.Core { maxHealth = 3, speedMultiplier = 1, + maxSpeed = 25f, maxJumps = 1, jumpForce = 500f, damage = 0, diff --git a/Assets/Scripts/RespawnPoint.cs b/Assets/Scripts/RespawnPoint.cs index b45ece1..2a1e52e 100644 --- a/Assets/Scripts/RespawnPoint.cs +++ b/Assets/Scripts/RespawnPoint.cs @@ -8,6 +8,7 @@ public class RespawnPoint : MonoBehaviour [SerializeField] private Sprite activatedSprite; private AudioManager _audio; + private bool activated; private void Start() { @@ -16,8 +17,9 @@ public class RespawnPoint : MonoBehaviour private void OnTriggerEnter2D(Collider2D collision) { - if (collision.gameObject.tag == "Player") + if (collision.gameObject.tag == "Player" && !activated) { + activated = true; collision.gameObject.GetComponent().spawnPoint = transform.position; gameObject.GetComponent().sprite = activatedSprite; _audio.Play("Checkpoint"); -- cgit v1.2.3-70-g09d2 From 0913419a48f22ac437b0bc6cb55805e547861143 Mon Sep 17 00:00:00 2001 From: Neil Kollack Date: Mon, 25 Apr 2022 11:30:42 -0500 Subject: fix: enemy speed bug, updated controls on menu --- .gitignore | 2 ++ Assets/Prefabs/Enemies/Mummy.prefab | 2 +- Assets/Prefabs/Enemies/Zombie.prefab | 2 +- Assets/Scenes/Start Scene.unity | 6 +++--- Packages/manifest.json | 1 + Packages/packages-lock.json | 24 ++++++++++++++++++++++++ webgl_sharing | 1 + 7 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 webgl_sharing (limited to 'Assets/Prefabs/Enemies/Zombie.prefab') diff --git a/.gitignore b/.gitignore index 57fb615..d8cb2ac 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ /[Bb]uilds/ /[Ll]ogs/ /[Uu]ser[Ss]ettings/ +/WebGL Builds/ # MemoryCaptures can get excessive in size. # They also could contain extremely sensitive data @@ -64,6 +65,7 @@ sysinfo.txt *.aab *.unitypackage *.app +*.zip # Crashlytics generated file crashlytics-build.properties diff --git a/Assets/Prefabs/Enemies/Mummy.prefab b/Assets/Prefabs/Enemies/Mummy.prefab index fc3c8e5..d33cb9f 100644 --- a/Assets/Prefabs/Enemies/Mummy.prefab +++ b/Assets/Prefabs/Enemies/Mummy.prefab @@ -159,7 +159,7 @@ MonoBehaviour: baseStats: maxHealth: 3 speedMultiplier: 1 - maxSpeed: 10 + maxSpeed: 20 maxJumps: 1 jumpForce: 500 damage: 0 diff --git a/Assets/Prefabs/Enemies/Zombie.prefab b/Assets/Prefabs/Enemies/Zombie.prefab index fe4e2f3..881fd6f 100644 --- a/Assets/Prefabs/Enemies/Zombie.prefab +++ b/Assets/Prefabs/Enemies/Zombie.prefab @@ -159,7 +159,7 @@ MonoBehaviour: baseStats: maxHealth: 3 speedMultiplier: 1 - maxSpeed: 10 + maxSpeed: 20 maxJumps: 1 jumpForce: 500 damage: 0 diff --git a/Assets/Scenes/Start Scene.unity b/Assets/Scenes/Start Scene.unity index 759aa6a..4437f54 100644 --- a/Assets/Scenes/Start Scene.unity +++ b/Assets/Scenes/Start Scene.unity @@ -629,9 +629,8 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_text: "Move: WASD\nJump: Space\nAttack:\n\tLeft-Click: Shoots\n\tRight-Click: - Cracks Whip (if within Whip Range)\nUse:\n\tRight-Click: Grapple to Grapple Points\n\nWhile - Grappling:\n\tMove: WASD\n\tRight-Click: Detach" + m_text: "Move: WASD\nJump: Space\nLeft-Click:\n\tAttack with Whip\n\tGrapple to + Grapple Points\n\nWhile Grappling:\n\tMove: WASD\n\tJump or Right-Click: Detach" m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} @@ -941,6 +940,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: treasure: {fileID: 0} + enemies: [] --- !u!1 &1853743052 GameObject: m_ObjectHideFlags: 0 diff --git a/Packages/manifest.json b/Packages/manifest.json index 0c43aa3..c909730 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -4,6 +4,7 @@ "com.unity.2d.tilemap": "1.0.0", "com.unity.2d.tilemap.extras": "2.2.1", "com.unity.collab-proxy": "1.15.13", + "com.unity.connect.share": "4.2.3", "com.unity.ide.rider": "3.0.12", "com.unity.ide.visualstudio": "2.0.14", "com.unity.ide.vscode": "1.2.5", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index c8a5818..f8a6f58 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -33,6 +33,23 @@ }, "url": "https://packages.unity.com" }, + "com.unity.connect.share": { + "version": "4.2.3", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.editorcoroutines": "1.0.0", + "com.unity.settings-manager": "1.0.2" + }, + "url": "https://packages.unity.com" + }, + "com.unity.editorcoroutines": { + "version": "1.0.0", + "depth": 1, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, "com.unity.ext.nunit": { "version": "1.0.6", "depth": 1, @@ -83,6 +100,13 @@ }, "url": "https://packages.unity.com" }, + "com.unity.settings-manager": { + "version": "1.0.3", + "depth": 1, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, "com.unity.test-framework": { "version": "1.1.31", "depth": 0, diff --git a/webgl_sharing b/webgl_sharing new file mode 100644 index 0000000..d21edb1 --- /dev/null +++ b/webgl_sharing @@ -0,0 +1 @@ +6266cad70946d601dd1c1a8a \ No newline at end of file -- cgit v1.2.3-70-g09d2