I got Error for Looping, it can't Stop.. how to fix it?
This makes no sense. This loop will always exit and never do anything useful. All the variables except i
are undefined.
Please post real code (not an image) and a real question for a real problem if you want a real answer.
I have sent the Real Code , I want Spawning Enemies by using that method in Function acak, when i compile, the operation can't Stop, it crass, enemies keep respawn. i miss something on it.. I got Stuck in for looping. Thanks in Advanced
Answer by Kur4ta · Apr 28, 2017 at 02:27 AM
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class LcgRandom : MonoBehaviour {
public int x;
public int i;
public int a;
protected int xn = 0;
public int c;
public int m = 7;
public int lcg;
private EnemyHealth ambil;
// Use this for initialization
void Start () {
ambil = GameObject.FindWithTag("Enemy").GetComponent<EnemyHealth>();
}
// Update is called once per frame
void Update () {
kolerasi ();
acak ();
}
public void kolerasi() {
c = ambil.NilaiCounter;
a = ambil.startingHealth;
}
public void acak() {
x = ((a * xn) + c);
lcg = x % m;
xn = lcg;
}
}
Your answer
Follow this Question
Related Questions
How can I avoid using switch and for too much? 2 Answers
Checking if all objects of an array are active at the same time 0 Answers
Can someone explain what IEnumerators and for statements are? 1 Answer
Checking if all objects of an array are active at the same time 0 Answers
Multiplying the same enemy 0 Answers