Hi, I am making a 2D game using the UI canvas system and I ran into a problem with the height the player jumps to, and the speed of the game overall. When I play the game in the editor on small screen, the player jumps higher, and the platform moves faster, then when I maximise on play the platform moves slower and the player jumps a lot lower. I have also built it through Xcode and tested on my iPad which also gives me a different result from the other 2. Is there any way that I can make the jump height constant, as well as the speed of the game overall? I have looked at lots of answers already but not of them have solved my issue. Below are my scripts for the player jumping and the platform movement. Thanks
Player jumping:
var myRigidbody : Rigidbody2D;
var _jumpSpeed = 1500.0f;
var grounded : boolean = false;
var groundCheck : Transform;
var groundRadius : float = 0.2f;
var whatIsGround : LayerMask;
function Start(){
myRigidbody = transform.gameObject.GetComponent(Rigidbody2D);
}
function FixedUpdate(){
grounded = Physics2D.OverlapCircle(groundCheck.position, groundRadius, whatIsGround);
if(grounded){
if(Input.GetMouseButtonDown(0))
myRigidbody.AddForce(new Vector2(0, _jumpSpeed * Time.fixedDeltaTime));
}
}
Platform movement:
var platformSpeed : float = 300.0f;
var beginLevel : boolean;
function Update(){
if(Input.GetMouseButtonDown(0))
beginLevel = true;
if(beginLevel)
transform.Translate(Vector3.right * Time.deltaTime * -platformSpeed);
}