Answer the question
In order to leave comments, you need to log in
How to make the character move and jump like in google chrome dinosaur river?
How to make a character move and jump like in google chrome dinosaurrek
Answer the question
In order to leave comments, you need to log in
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class your script name : MonoBehaviour
{
public float speed;
public float jumpForce;
protected bool doJump = false;
public Rigidbody2D rb;
// Start is called before the first frame update
void FixedUpdate()
{
if(doJump)
{
rb.AddForce(Vector3.up * jumpspeed, ForceMode2D.Impulse);
dojump=false;
}
}
// Update is called once per frame
void Update()
{
transform.Translate(Vector3.right * speed);
if(Input.GetKeyDown("space"))
{
doJump = true;
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question