hi pls I need someones help. i am not good at programming and i have this subject ; but i am a BSBA major. it is like free section for me and i want to learn it to so i can be flexible. but this project is getting all my soul. We where told to create a game using a C# . a very simple game . then the prof listed games to pick like snake, tictactoe, etc. i picked the slot machine figuring that i already thought that its using timer , and bunch of if statements so i picked it. I am already done with the timer part and pictures part but the if statement is what i have been troubled. i dont know what to do. i thought that its only if pic1.image== pic2.image. /// so on so forth.....
can you help me i want it to be when the picturebox hit lets say 3 banana the amount bet is multiplied.... here i will post my codes as well as a linked to download my project.... i really badly need some1 help.
in the downloadable is forgot to put a \ on the end part of the path.
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;
using System.Resources;
namespace Project_final
{
public partial class Form1 : Form
{
Random r = new Random();
string path = @"C:\Users\KiDkArDeL\Documents\Visual Studio 2012\Projects\Project_final\Project_final\obj\Debug\pikapika\";
List<int> RemainNums;
List<int> RemainNums2;
List<int> RemainNums3;
int ARandomNumber;
int ARandomNumber2;
int ARandomNumber3;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
if (MessageBox.Show("Only age of 18+ are allowed to play application. Is your age 18+?", "Player Verifyer", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.No)
{
MessageBox.Show("APPLICATION DISABLED!", "warning", MessageBoxButtons.OK, MessageBoxIcon.Stop);
button1.Visible = false;
label1.Visible = false;
numericUpDown1.Visible = false;
}
else
{
this.Enabled = true;
}
}
private void button1_Click(object sender, EventArgs e)
{
}
private void button1_Click_1(object sender, EventArgs e)
{
if (numericUpDown1.Value > 0)
{
numericUpDown2.Visible = true;
label7.Visible = true;
pic7.Visible = true;
pic8.Visible = true;
pic9.Visible = true;
button1.Enabled = false;
button1.Hide();
label1.Hide();
label3.Text = numericUpDown1.Value.ToString();
numericUpDown1.Hide();
label3.Visible = true;
label2.Visible = true;
pictureBox2.Visible = true;
pictureBox6.Visible = true;
pictureBox7.Visible = true;
pictureBox8.Visible = true;
pictureBox9.Visible = true;
label10.Visible = true;
label18.Visible = true;
label12.Visible = true;
pic6.Visible = true;
pic5.Visible = true;
pic4.Visible = true;
pic3.Visible = true;
pic2.Visible = true;
pic1.Visible = true;
label14.Visible = true;
label16.Visible = true;
label5.Visible = true;
button2.Visible = true;
label8.Visible = true;
textBox1.Visible = true;
radioButton1.Visible = true;
radioButton2.Visible = true;
timer1.Start();
button3.Visible = true;
}
else
{
MessageBox.Show("You cannot play with no money! Comeback when you have one!", "Too Poor to Play", MessageBoxButtons.OK, MessageBoxIcon.Warning);
this.Close();
}
}
private void pictureBox2_Click(object sender, EventArgs e)
{
}
private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
if (numericUpDown2.Value > numericUpDown1.Value)
{
MessageBox.Show("Invalid, You don't have enough money.", "NO MONEY", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
else if (numericUpDown2.Value == 0)
{
MessageBox.Show("Remember. Minimum bet is 1 while maximum is 100", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else if (numericUpDown2.Value >= 101)
{
MessageBox.Show("Remember. Minimum bet is 1 while maximum is 100", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
label3.Text = (numericUpDown1.Value - numericUpDown2.Value).ToString();
numericUpDown2.Value = 0;
numericUpDown1.Value = Convert.ToInt32(label3.Text);
SLOTMECH.Start();
button2.Enabled = false;
}
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
textBox1.Text = "1.) Place the amount of bet you want in the box provided. The minimum bet is 1 while the maximum is 100. \r\n" + "2.)Press Bet button to start the roll \r\n" + "3.) Press Stop to stop the roll\r\n" + "4.)ENJOY!\r\n";
}
private void label8_Click(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
textBox1.Text = "1.) Ilagay ang halaga ng pera na iyong gustong itaya sa kahon.1 ang pinakamababang halaga at 100 ang pinakamataas. \r\n" + "2.)Pindutin ang Bet para magsimula \r\n" + "3.)Pindutin ang Stop upang tumigil\r\n" + "4.)MAGSAYA!\r\n";
}
private void label9_Click(object sender, EventArgs e)
{
}
private void timer1_Tick(object sender, EventArgs e)
{
label18.Text = (DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString());
}
private void numericUpDown2_ValueChanged(object sender, EventArgs e)
{
}
private void numericUpDown2_KeyDown(object sender, KeyEventArgs e)
{
}
private void SLOTMECH_Tick(object sender, EventArgs e)
{
if (SLOTMECH.Interval > 26)
{
SLOTMECH.Interval = SLOTMECH.Interval -25;
}
else {
SLOTMECH.Interval = 1;
}
RemainNums = new List<int>();
RemainNums.AddRange(new int[] { 0,1,2,3,4 });
RemainNums2 = new List<int>();
RemainNums2.AddRange(new int[] { 1,4,0,2,3 });
RemainNums3 = new List<int>();
RemainNums3.AddRange(new int[] { 3,4,1,2,0 });
int index = r.Next(0, RemainNums.Count - 1);
ARandomNumber = RemainNums[index];
RemainNums.RemoveAt(index);
ARandomNumber2 = RemainNums2[index];
RemainNums2.RemoveAt(index);
pic1.Image = Image.FromFile(path + ARandomNumber + ".jpg");
index = r.Next(0, RemainNums.Count - 1);
ARandomNumber = RemainNums[index];
RemainNums.RemoveAt(index);
pic4.Image = Image.FromFile(path + ARandomNumber + ".jpg");
index = r.Next(0, RemainNums.Count - 1);
ARandomNumber = RemainNums[index];
RemainNums.RemoveAt(index);
pic7.Image = Image.FromFile(path + ARandomNumber + ".jpg");
pic2.Image = Image.FromFile(path + ARandomNumber2 + ".jpg");
index = r.Next(0, RemainNums2.Count - 1);
ARandomNumber2 = RemainNums2[index];
RemainNums2.RemoveAt(index);
pic5.Image = Image.FromFile(path + ARandomNumber2 + ".jpg");
index = r.Next(0, RemainNums2.Count - 1);
ARandomNumber2 = RemainNums2[index];
RemainNums2.RemoveAt(index);
pic8.Image = Image.FromFile(path + ARandomNumber2 + ".jpg");
ARandomNumber3 = RemainNums3[index];
RemainNums3.RemoveAt(index);
pic3.Image = Image.FromFile(path + ARandomNumber3 + ".jpg");
index = r.Next(0, RemainNums3.Count - 1);
ARandomNumber3 = RemainNums3[index];
RemainNums3.RemoveAt(index);
pic6.Image = Image.FromFile(path + ARandomNumber3 + ".jpg");
index = r.Next(0, RemainNums3.Count - 1);
ARandomNumber3 = RemainNums3[index];
RemainNums3.RemoveAt(index);
pic9.Image = Image.FromFile(path + ARandomNumber3 + ".jpg");
}
private void button3_Click_1(object sender, EventArgs e)
{
SLOTMECH.Stop();
SLOTMECH.Interval = 300;
button2.Enabled = true;
//insert if statement here for when pic1 is "0.jpg" and pic2 is 0.jpg and pic3 is 0.jpg bet amount is multipled to 2. pls just give me one if sample and ill figure it out
}
private void pictureBox12_Click(object sender, EventArgs e)
{
}
}
}
the link: http://www.4shared.com/zip/1bJpVMk4/project_final_2.html
really appreciate the help.