Answer the question
In order to leave comments, you need to log in
Bugs in Unity script?
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using UnityEngine;
public class jostik : MonoBehaviour
{
public jostik Jostik;
Rigidbody2D rb;
float run;
bool jump = true;
// Start is called before the first frame update
void Start()
{
rb = GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void Update()
{
run = jostik.Horizontal * 5f;
if(jostik.Vertical >= .5f & jump)
{
jump = false;
rb.velocity = Vector3.zero;
rb.AddForce(transform.up * 7.5f, ForceMode2D.Impulse);
}
//разгон
rb.velocity = new Vector2(run, rb.velocity.y);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question