image list and timer affects

hooverbloob

New member
Joined
Sep 20, 2005
Messages
4
Programming Experience
Beginner
I'm trying to program a promotional "game" that will look similar to a slot machine. I have 5 graphics and 3 picture boxes. I would like the pictures to show up randomly when the start button is pressed then stop when the stop button is pressed.

I have an imagelist setup with the graphics but I'm not sure how to use the image list with the timer.

Any ideas?
 
Yes only 5 :eek:) Thanks so much! I'm new to the forum and I see you answering the majority of stuff. Do you do this in your spare time for fun or do you get paid to help the ignornant? LOL
 
Slot machine

All you need is just a few lines of code:

VB.NET:
[size=2][color=#0000ff]Private [/color][/size][size=2][color=#0000ff]Sub[/color][/size][size=2] Timer1_Tick([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] sender [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.Object, [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] e [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.EventArgs) [/size][size=2][color=#0000ff]Handles[/color][/size][size=2] Timer1.Tick
 
Label1.ImageIndex = [/size][size=2][color=#0000ff]CType[/color][/size][size=2](Int(Rnd() * 5), [/size][size=2][color=#0000ff]Integer[/color][/size][size=2])
 
Label2.ImageIndex = [/size][size=2][color=#0000ff]CType[/color][/size][size=2](Int(Rnd() * 5), [/size][size=2][color=#0000ff]Integer[/color][/size][size=2])
 
Label3.ImageIndex = [/size][size=2][color=#0000ff]CType[/color][/size][size=2](Int(Rnd() * 5), [/size][size=2][color=#0000ff]Integer[/color][/size][size=2])
 
[/size][size=2][color=#0000ff]End [/color][/size][size=2][color=#0000ff]Sub
 
[/color][/size][size=2][color=#0000ff]Private [/color][/size][size=2][color=#0000ff]Sub[/color][/size][size=2] Button1_Click([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] sender [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.Object, [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] e [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.EventArgs) [/size][size=2][color=#0000ff]Handles[/color][/size][size=2] Button1.Click
 
Timer1.Enabled = [/size][size=2][color=#0000ff]True
 
[/color][/size][size=2][color=#0000ff]End [/color][/size][size=2][color=#0000ff]Sub
 
[/color][/size][size=2][color=#0000ff]Private [/color][/size][size=2][color=#0000ff]Sub[/color][/size][size=2] Button2_Click([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] sender [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.Object, [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] e [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.EventArgs) [/size][size=2][color=#0000ff]Handles[/color][/size][size=2] Button2.Click
 
Timer1.Enabled = [/size][size=2][color=#0000ff]False
 
[/color][/size][size=2][color=#0000ff]End [/color][/size][size=2][color=#0000ff]Sub[/color][/size]
[size=2][color=#0000ff]
[/color][/size]

It is amazing. isn't it? ;)

No dude i'm not paid for this :( maybe in the future who knows hahaha

Regards ;)

note that you can add more features there ... i'm illustrating only basic stuff here.
 

Attachments

  • SlotGame.zip
    44.1 KB · Views: 62
Sounds like a lot of fun! I'm for it! I just need to finish this project first then I can work on it some more.

Your reply was awesome...got me to what I needed to get done! Thanks so much for your fast reply! I'll be in touch..

Karen
 
Well, what I had to do on my project is display a winner/loser type of label. I set up 2 labels, one that said Congradulations!!! and the other that said "Better luck next time".

Then in the stop button click event I used an if/then/else statement to say if the images all equal each other then show the winner label, if not, show the loser label. Hitting the Go button would then hide the labels.

One thing I thought that would be neat is to track how many winners/losers there are and print a report for that day/time.

Maybe we could even hold a user name to keep track of who is on there and keeps winning.

If you wanted to play with what the odds are of winning, you could also keep track of what images matched the most or how many turns it took to win.

I know when I was testing it I thought for sure I'd never win, but I did. It sometimes took a long time. :)

How about flashing the screen with different colors when there is a winner?

Any way...just some thoughts. My mother loves to play the slots...personally, I never became all that interested in it when I visited gambling spots, but programming this has been really fun!
 
Back
Top