Assets\player.cs(37,30): error CS1513: } expected
,Assets\player.cs(37,30): error CS 1002: ; expected
This is the code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class player : MonoBehaviour
{
public float speed;
public float JumpForce;
private Rigidbody2D rig;
// Start is called before the first frame update
void Start()
{
rig = GetComponent();
}
// Update is called once per frame
void Update()
{
rig.velocity = new Vector2(speed, rig.velocity.y);
if (Input.GetMouseButtonDown(0) && !isJumping){
rig.AddForce(Vector2.up * JumpForce, ForceMode2D.Impulse);
isJumping = true;
}
}
void OnCollisonEnter2D(Collision2D colisor){
if (colisor.gameObject.layer == 8){
isJumping = false:
}
}
}
↧