#region Using Statements
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
#endregion
namespace myCardandBonesGame1
{
public partial class Form1 : Form
{
#region Declaration
Image[] diceImages;
int[] diceRoll;
Random rand;
Image[] cardImages;
int[] dealCard;
#endregion
#region Inititalization
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
diceImages = new Image[6];
diceImages[0] = Properties.Resources.die_1;
diceImages[1] = Properties.Resources.die_2;
diceImages[2] = Properties.Resources.die_3;
diceImages[3] = Properties.Resources.die_4;
diceImages[4] = Properties.Resources.die_5;
diceImages[5] = Properties.Resources.die_6;
diceRoll = new int[2] { 0, 0, };
rand = new Random();
}
#region Private MethodsDice
private void button1_Click(object sender, EventArgs e)
{
RollDice();
}
private void RollDice()
{
for (int d = 0; d < diceRoll.Length; d++)
diceRoll[d] = rand.Next(6);
pictureBox1.Image = diceImages[diceRoll[0]];
pictureBox2.Image = diceImages[diceRoll[1]];
}
#endregion
#region Inititalization
private Form1()
//I get Error: 1Type 'myCardandBonesGame1.Form1' already defines a member called 'Form1' with the same
parameter type myCardandBonesGame1
{
InitializeComponent();
}
#region Public MethodsCards
Is there a way to pass the parameters in this code? I'm not sure what to do here.
I am very new to coding learning on my own, so if you do respond please put it in laymen
terms, so that I may understand better. Thanks.
private void Form1_Load(object sender, System.EventArgs e)
//I get Error: 1Type 'myCardandBonesGame1.Form1' already defines a member called 'Form1' with the same
parameter type myCardandBonesGame1
{
cardImages = new Image[52];
Thank you, :-)
No comments:
Post a Comment