Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

I get 2 errors in my AI script and 1 warning and can`t figure it out by myself..

$
0
0
1. (35,20): error CS1525: Unexpected symbol `else' 2. (52,1): error CS8025: Parsing error 3. (33,17): warning CS0642: Possible mistaken empty statement using UnityEngine; using System.Collections; public class AI1: MonoBehaviour { public Vector3 Player; public Vector2 PlayerDirection; private float Xdif; private float Ydif; public Transform target; public float speed; public float rotatespeed = 5f; private float rotZ; private int Wall; private float distance; private bool stun; private float stuntime; void Start () { stuntime = 0; stun = false; Wall = 1 << 8; speed = 0.9f; } void Update () { distance = Vector2.Distance (Player, transform.position); Player = GameObject.Find("Player").transform.position; if(stuntime > 0)( stuntime -= Time.deltaTime) else { stun = false) } if (distance < 1.5 && !stun) { Xdif = Player.x - transform.position.x; Ydif = Player.y - transform.position.y; PlayerDirection = new Vector2 (Xdif, Ydif); if (!Physics2D.Raycast (transform.position, PlayerDirection, 3, Wall)) { rigidbody2D.AddForce (PlayerDirection.normalized * speed); } rotZ = Mathf.Atan2 (Player.y, Player.x) * Mathf.Rad2Deg; transform.rotation = Quaternion.LookRotation ((new Vector3 (0f, 0f, rotZ))); } } } void OnCollisionEnter2D (Collision2D Playerhit)( if (Playerhit.gameobject.tag ("Player"){ stun = true; stuntime = 1; } } }

Viewing all articles
Browse latest Browse all 7934

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>