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);
}
}