S
S
super-boy-vasek2020-06-11 16:34:09
C++ / C#
super-boy-vasek, 2020-06-11 16:34:09

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

2 answer(s)
G
Griboks, 2020-06-11
@Griboks

Maybe you need to change the wordsjostik Jostik;

H
HemulGM, 2020-06-11
@HemulGM

Yes, mistakes

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question