Agent 7
New member
- Joined
- Mar 8, 2021
- Messages
- 2
- Programming Experience
- Beginner
Hi guys!! I wanted to ask for help for this game that I'm making. please help me to debug the program thanks the error message at the top
C#:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameManager : MonoBehaviour {
private int selectedZombiePosition = 0 ;
public GameObject selectedZombie;
public List<GameObject> zombies;
public Vector3 selectedSize;
public Vector3 defaultSize;
// Start is called before the first frame update
void Start () {
SelectZombie (selectedZombie);
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown ("left")); {
GetZombieLeft ();
}
if (Input.GetKeyDown ("right")); {
GetZombieRight ();
}
if (Input.GetKeyDown ("up"));
}
void GetZombieLeft() {
if (selectedZombiePosition == 0) {
SelectZombie (zombies [3]);
} else {
GameObject newZombie = (zombies [selectedZombiePosition - 1]);
SelectZombie (newZombie);
}
}
void GetZombieRight() {
if (selectedZombiePosition == 3); {
SelectZombie (zombies [0]);
} else {
SelectZombie (zombies [selectZombiePosition + 1]);
}
}
void SelectZombie(GameObject newZombie) {
newZombie.transform.localScale = selectedSize;
}
}
Last edited by a moderator: