Am trying to code a blackjack game as my first project in C# and this is my first attempt and I've been getting this error :
Assets\NewBehaviourScript.cs(17,9): error CS0103: The name 'playerdeck' does not exist in the current context
Assets\NewBehaviourScript.cs(17,24): error CS0103: The name 'random' does not exist in the current context
This is my code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
char[] Deck={'A','2','3','4','5','6','7','8','9','J','Q','K'};
List<char> playerdeck = new List<char>();
}
// Update is called once per frame
void Update()
{
playerdeck.Add(random.next(0, Deck.length));
playerdeck.Add(random.next(0, Deck.length));
System.Console.Write(playerdeck[0]);
System.Console.Write(playerdeck[1]);
}
}
Aucun commentaire:
Enregistrer un commentaire