Fix player movement on screens

This commit is contained in:
Lncvrt committed 2026-03-03 23:05:15 -07:00
1 parent 8a6886f7d0
commit f3fee721ad
6 files changed
+44 -41

No files matched your search

@@ -7003,11 +7003,11 @@ Rigidbody2D:
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 1
m_Mass: 6431.0283
m_UseAutoMass: 0
m_Mass: 1
m_LinearDamping: 0
m_AngularDamping: 0
m_GravityScale: 80
m_GravityScale: 0
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
@@ -7285,7 +7285,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 64, y: 64}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!58 &1942583458
CircleCollider2D:
@@ -7322,7 +7322,7 @@ CircleCollider2D:
m_CompositeOperation: 0
m_CompositeOrder: 0
m_Offset: {x: 0, y: 0}
m_Radius: 32
m_Radius: 50
--- !u!50 &1942583459
Rigidbody2D:
serializedVersion: 5
@@ -2314,11 +2314,11 @@ Rigidbody2D:
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 1
m_Mass: 6431.0283
m_UseAutoMass: 0
m_Mass: 1
m_LinearDamping: 0
m_AngularDamping: 0
m_GravityScale: 80
m_GravityScale: 0
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
@@ -7551,7 +7551,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 64, y: 64}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!58 &1645646559
CircleCollider2D:
@@ -7588,7 +7588,7 @@ CircleCollider2D:
m_CompositeOperation: 0
m_CompositeOrder: 0
m_Offset: {x: 0, y: 0}
m_Radius: 32
m_Radius: 50
--- !u!50 &1645646560
Rigidbody2D:
serializedVersion: 5
+5 -5
View File
@@ -6289,11 +6289,11 @@ Rigidbody2D:
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 1
m_Mass: 6431.0283
m_UseAutoMass: 0
m_Mass: 1
m_LinearDamping: 0
m_AngularDamping: 0
m_GravityScale: 80
m_GravityScale: 0
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
@@ -8685,7 +8685,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 64, y: 64}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1911142116
MonoBehaviour:
@@ -8787,7 +8787,7 @@ CircleCollider2D:
m_CompositeOperation: 0
m_CompositeOrder: 0
m_Offset: {x: 0, y: 0}
m_Radius: 32
m_Radius: 50
--- !u!1 &1925650813
GameObject:
m_ObjectHideFlags: 0
+9 -8
View File
@@ -197,21 +197,21 @@ public class AutoGamePlayer : MonoBehaviour {
}
}
if (doMoveLeft && !doMoveRight) {
bird.transform.position += new UnityEngine.Vector3(-(1.7f * speedModifier), 0f, 0f);
bird.transform.position += new UnityEngine.Vector3(-(2.4f * (speedModifier * canvasRect.lossyScale.x)), 0f, 0f);
ClampPosition(bird);
bird.transform.localScale = new UnityEngine.Vector3(1f, 1f, 1f);
}
if (doMoveRight && !doMoveLeft) {
bird.transform.position += new UnityEngine.Vector3(1.7f * speedModifier, 0f, 0f);
bird.transform.position += new UnityEngine.Vector3(2.4f * (speedModifier * canvasRect.lossyScale.x), 0f, 0f);
ClampPosition(bird);
bird.transform.localScale = new UnityEngine.Vector3(-1f, 1f, 1f);
}
if (doMoveLeft || doMoveRight) groundCollider.transform.position = new(bird.transform.position.x, groundCollider.transform.position.y);
if (doJump && IsGrounded()) {
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Jump"), Camera.main.transform.position, 0.75f * BazookaManager.Instance.GetSettingSFXVolume());
if (boostLeft > 0f || speedyLeft > 0f) rb.linearVelocity = new UnityEngine.Vector2(rb.linearVelocity.x, 380f);
else if (slownessLeft > 0f) rb.linearVelocity = new UnityEngine.Vector2(rb.linearVelocity.x, 220f);
else rb.linearVelocity = new UnityEngine.Vector2(rb.linearVelocity.x, 300f);
if (boostLeft > 0f || speedyLeft > 0f) rb.linearVelocity = new UnityEngine.Vector2(rb.linearVelocity.x, 480f * canvasRect.lossyScale.y);
else if (slownessLeft > 0f) rb.linearVelocity = new UnityEngine.Vector2(rb.linearVelocity.x, 300f * canvasRect.lossyScale.y);
else rb.linearVelocity = new UnityEngine.Vector2(rb.linearVelocity.x, 380f * canvasRect.lossyScale.y);
}
if (doBack) {
TogglePause();
@@ -278,7 +278,7 @@ public class AutoGamePlayer : MonoBehaviour {
float spawnProbability = UnityEngine.Random.value;
if (!pausePanel.activeSelf) {
Image newBerry = Instantiate(berryTemplate).GetComponent<Image>();
newBerry.transform.SetParent(berryParent.transform);
newBerry.transform.SetParent(berryParent.transform, false);
if (spawnProbability <= 0.425f) {
newBerry.sprite = Resources.Load<Sprite>("Berries/Berry");
@@ -315,6 +315,7 @@ public class AutoGamePlayer : MonoBehaviour {
}
void Update() {
if (!pausePanel.activeSelf && rb.gravityScale != 100f * canvasRect.lossyScale.y) rb.gravityScale = 100f * canvasRect.lossyScale.y;
foreach (AudioSource audio in FindObjectsByType<AudioSource>(FindObjectsSortMode.None)) audio.pitch = speedyLeft > 0f ? 1.3f : 1f;
GameObject[] allBerries = GameObject.FindGameObjectsWithTag("NormalBerry")
@@ -358,7 +359,7 @@ public class AutoGamePlayer : MonoBehaviour {
break;
}
}
if (berry != null) berry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, speedyLeft == 0.0f ? -200f : -375f);
if (berry != null) berry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, speedyLeft == 0.0f ? (-200f * canvasRect.lossyScale.y) : (-375f * canvasRect.lossyScale.y));
}
else foreach (GameObject berry in allBerries) berry.GetComponent<Rigidbody2D>().linearVelocity = UnityEngine.Vector2.zero;
if ((Application.platform == RuntimePlatform.Android && Keyboard.current.escapeKey.wasPressedThisFrame) || !Application.isMobilePlatform && (Keyboard.current.escapeKey.wasPressedThisFrame || (Gamepad.current != null && (Gamepad.current.startButton.wasPressedThisFrame || Gamepad.current.buttonEast.wasPressedThisFrame)))) TogglePause();
@@ -425,7 +426,7 @@ public class AutoGamePlayer : MonoBehaviour {
}
internal void DisablePause() {
rb.gravityScale = 80f;
rb.gravityScale = 100f * canvasRect.lossyScale.y;
rb.linearVelocity = velocityBeforePause;
velocityBeforePause = new();
if (AutoGamePlayerPauseMenu.Instance.statsMenu.activeSelf) {
+11 -10
View File
@@ -150,12 +150,12 @@ public class CustomGamePlayer : MonoBehaviour {
}
}
if (doMoveLeft && !doMoveRight) {
bird.transform.position += new UnityEngine.Vector3(-(1.7f * speedModifier), 0f, 0f);
bird.transform.position += new UnityEngine.Vector3(-(2.4f * (speedModifier * canvasRect.lossyScale.x)), 0f, 0f);
ClampPosition(bird);
bird.transform.localScale = new UnityEngine.Vector3(1f, 1f, 1f);
}
if (doMoveRight && !doMoveLeft) {
bird.transform.position += new UnityEngine.Vector3(1.7f * speedModifier, 0f, 0f);
bird.transform.position += new UnityEngine.Vector3(2.4f * (speedModifier * canvasRect.lossyScale.x), 0f, 0f);
ClampPosition(bird);
bird.transform.localScale = new UnityEngine.Vector3(-1f, 1f, 1f);
}
@@ -324,21 +324,21 @@ public class CustomGamePlayer : MonoBehaviour {
}
}
if (doMoveLeft && !doMoveRight) {
bird.transform.position += new UnityEngine.Vector3(-(1.7f * speedModifier), 0f, 0f);
bird.transform.position += new UnityEngine.Vector3(-(2.4f * (speedModifier * canvasRect.lossyScale.x)), 0f, 0f);
ClampPosition(bird);
bird.transform.localScale = new UnityEngine.Vector3(1f, 1f, 1f);
}
if (doMoveRight && !doMoveLeft) {
bird.transform.position += new UnityEngine.Vector3(1.7f * speedModifier, 0f, 0f);
bird.transform.position += new UnityEngine.Vector3(2.4f * (speedModifier * canvasRect.lossyScale.x), 0f, 0f);
ClampPosition(bird);
bird.transform.localScale = new UnityEngine.Vector3(-1f, 1f, 1f);
}
if (doMoveLeft || doMoveRight) groundCollider.transform.position = new(bird.transform.position.x, groundCollider.transform.position.y);
if (doJump && IsGrounded()) {
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Jump"), Camera.main.transform.position, 0.75f * BazookaManager.Instance.GetSettingSFXVolume());
if (boostLeft > 0f || speedyLeft > 0f) rb.linearVelocity = new UnityEngine.Vector2(rb.linearVelocity.x, 380f);
else if (slownessLeft > 0f) rb.linearVelocity = new UnityEngine.Vector2(rb.linearVelocity.x, 220f);
else rb.linearVelocity = new UnityEngine.Vector2(rb.linearVelocity.x, 300f);
if (boostLeft > 0f || speedyLeft > 0f) rb.linearVelocity = new UnityEngine.Vector2(rb.linearVelocity.x, 480f * canvasRect.lossyScale.y);
else if (slownessLeft > 0f) rb.linearVelocity = new UnityEngine.Vector2(rb.linearVelocity.x, 300f * canvasRect.lossyScale.y);
else rb.linearVelocity = new UnityEngine.Vector2(rb.linearVelocity.x, 380f * canvasRect.lossyScale.y);
}
if (doBack) {
TogglePause();
@@ -407,7 +407,7 @@ public class CustomGamePlayer : MonoBehaviour {
if (!pausePanel.activeSelf) {
float cumulative = 0f;
Image newBerry = Instantiate(berryTemplate).GetComponent<Image>();
newBerry.transform.SetParent(berryParent.transform);
newBerry.transform.SetParent(berryParent.transform, false);
cumulative += normalBerryChance / 100f;
if (spawnProbability <= cumulative) {
@@ -473,6 +473,7 @@ public class CustomGamePlayer : MonoBehaviour {
}
void Update() {
if (!pausePanel.activeSelf && rb.gravityScale != 100f * canvasRect.lossyScale.y) rb.gravityScale = 100f * canvasRect.lossyScale.y;
foreach (AudioSource audio in FindObjectsByType<AudioSource>(FindObjectsSortMode.None)) audio.pitch = speedyLeft > 0f ? 1.3f : 1f;
GameObject[] allBerries = GameObject.FindGameObjectsWithTag("NormalBerry")
@@ -519,7 +520,7 @@ public class CustomGamePlayer : MonoBehaviour {
break;
}
}
if (berry != null) berry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, speedyLeft == 0.0f ? -200f : -375f);
if (berry != null) berry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, speedyLeft == 0.0f ? (-200f * canvasRect.lossyScale.y) : (-375f * canvasRect.lossyScale.y));
}
else foreach (GameObject berry in allBerries) berry.GetComponent<Rigidbody2D>().linearVelocity = UnityEngine.Vector2.zero;
if ((Application.platform == RuntimePlatform.Android && Keyboard.current.escapeKey.wasPressedThisFrame) || !Application.isMobilePlatform && (Keyboard.current.escapeKey.wasPressedThisFrame || (Gamepad.current != null && (Gamepad.current.startButton.wasPressedThisFrame || Gamepad.current.buttonEast.wasPressedThisFrame)))) TogglePause();
@@ -575,7 +576,7 @@ public class CustomGamePlayer : MonoBehaviour {
}
internal void DisablePause() {
rb.gravityScale = 80f;
rb.gravityScale = 100f * canvasRect.lossyScale.y;
rb.linearVelocity = velocityBeforePause;
velocityBeforePause = new();
if (CustomGamePlayerPauseMenu.Instance.editingUI == true) {
+9 -8
View File
@@ -136,21 +136,21 @@ public class GamePlayer : MonoBehaviour {
}
}
if (doMoveLeft && !doMoveRight) {
bird.transform.position += new UnityEngine.Vector3(-(1.7f * speedModifier), 0f, 0f);
bird.transform.position += new UnityEngine.Vector3(-(2.4f * (speedModifier * canvasRect.lossyScale.x)), 0f, 0f);
ClampPosition(bird);
bird.transform.localScale = new UnityEngine.Vector3(1f, 1f, 1f);
}
if (doMoveRight && !doMoveLeft) {
bird.transform.position += new UnityEngine.Vector3(1.7f * speedModifier, 0f, 0f);
bird.transform.position += new UnityEngine.Vector3(2.4f * (speedModifier * canvasRect.lossyScale.x), 0f, 0f);
ClampPosition(bird);
bird.transform.localScale = new UnityEngine.Vector3(-1f, 1f, 1f);
}
if (doMoveLeft || doMoveRight) groundCollider.transform.position = new(bird.transform.position.x, groundCollider.transform.position.y);
if (doJump && IsGrounded()) {
AudioSource.PlayClipAtPoint(Resources.Load<AudioClip>("Sounds/Jump"), Camera.main.transform.position, 0.75f * BazookaManager.Instance.GetSettingSFXVolume());
if (boostLeft > 0f || speedyLeft > 0f) rb.linearVelocity = new UnityEngine.Vector2(rb.linearVelocity.x, 380f);
else if (slownessLeft > 0f) rb.linearVelocity = new UnityEngine.Vector2(rb.linearVelocity.x, 220f);
else rb.linearVelocity = new UnityEngine.Vector2(rb.linearVelocity.x, 300f);
if (boostLeft > 0f || speedyLeft > 0f) rb.linearVelocity = new UnityEngine.Vector2(rb.linearVelocity.x, 480f * canvasRect.lossyScale.y);
else if (slownessLeft > 0f) rb.linearVelocity = new UnityEngine.Vector2(rb.linearVelocity.x, 300f * canvasRect.lossyScale.y);
else rb.linearVelocity = new UnityEngine.Vector2(rb.linearVelocity.x, 380f * canvasRect.lossyScale.y);
}
if (doBack) {
TogglePause();
@@ -220,7 +220,7 @@ public class GamePlayer : MonoBehaviour {
float spawnProbability = UnityEngine.Random.value;
if (!pausePanel.activeSelf) {
Image newBerry = Instantiate(berryTemplate).GetComponent<Image>();
newBerry.transform.SetParent(berryParent.transform);
newBerry.transform.SetParent(berryParent.transform, false);
if (spawnProbability <= 0.375f) {
newBerry.sprite = Resources.Load<Sprite>("Berries/Berry");
@@ -260,6 +260,7 @@ public class GamePlayer : MonoBehaviour {
}
void Update() {
if (!pausePanel.activeSelf && rb.gravityScale != 100f * canvasRect.lossyScale.y) rb.gravityScale = 100f * canvasRect.lossyScale.y;
foreach (AudioSource audio in FindObjectsByType<AudioSource>(FindObjectsSortMode.None)) audio.pitch = speedyLeft > 0f ? 1.3f : 1f;
GameObject[] allBerries = GameObject.FindGameObjectsWithTag("NormalBerry")
@@ -306,7 +307,7 @@ public class GamePlayer : MonoBehaviour {
break;
}
}
if (berry != null) berry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, speedyLeft == 0.0f ? -200f : -375f);
if (berry != null) berry.GetComponent<Rigidbody2D>().linearVelocity = new UnityEngine.Vector2(0f, speedyLeft == 0.0f ? (-200f * canvasRect.lossyScale.y) : (-375f * canvasRect.lossyScale.y));
}
else foreach (GameObject berry in allBerries) berry.GetComponent<Rigidbody2D>().linearVelocity = UnityEngine.Vector2.zero;
if ((Application.platform == RuntimePlatform.Android && Keyboard.current.escapeKey.wasPressedThisFrame) || !Application.isMobilePlatform && (Keyboard.current.escapeKey.wasPressedThisFrame || (Gamepad.current != null && (Gamepad.current.startButton.wasPressedThisFrame || Gamepad.current.buttonEast.wasPressedThisFrame)))) TogglePause();
@@ -390,7 +391,7 @@ public class GamePlayer : MonoBehaviour {
}
internal void DisablePause() {
rb.gravityScale = 80f;
rb.gravityScale = 100f * canvasRect.lossyScale.y;
rb.linearVelocity = velocityBeforePause;
velocityBeforePause = new();
if (GamePlayerPauseMenu.Instance.statsMenu.activeSelf) {