Ive been working on this for ages now i am supposed to b doing it in c# part i find it impossible so im doing it in Visual Basics
This is my current code atm:
Code: Public Class Form1 Dim n As Integer Dim oney As Integer
[CODE]...
Now i have the dice working and all that, the proplem is that to get the picturebox3 which is the players counter, if i do it the way im doing it atm its gonna take ages there must b a quicker way, i am thinking that arrays is suming i should use but im not that familier with them, i tryed this code using arrays:
Code: bored(0) = PictureBox3.Location = New Point(210, 476) bored(1) = PictureBox3.Location = New Point(270, 476) bored(2) = PictureBox3.Location = New Point(320, 476)
[CODE]...
But when i tried clicking button 2 it didnt show the picture box at the right location it showed it at 0,0
I'm working on the code I used to make the animated dice program in my sig. I've done a bit of modding on it so I can re-use parts and it still worked fine, until I tried to put everything in a class so that I could just create new instances of a certain die.
I was heading towards the idea of creating a new instance of the die by a number in a textbox on the main form. Right now I am just working on the basic d6 just to get it up and running.
QuoteAn error occurred creating the form. See Exception.InnerException for details. The error is: The form referred to itself during construction from a default instance, which led to infinite recursion. Within the Form's constructor refer to the form using 'Me.'
I am probably going about this the wrong way all together and could use some help because I can't see how the class is referring to itself at all.
[code...]
doesn't look much better in the original program, but it actually works in that so if it helps just click the link in my sig to go to the post with the original download.
Since I am going to want all the various dice to Rotate() and Move(), I am wanting these to be generic so that I can use them no matter which die is trying to access it which is why I have tried putting them separately in their own subs and just passing the picture ByVal. I'm not sure if, or how, to put these in classes of their own or not.
And I have looked at just about every dice roller and Yahtzee example I can find, but none of them actually try to rotate the dice like I have, and they pretty much just calculate by using simple random values...which is okay, but does squat when the values are actual objects instead of numbers (if that makes sense).
Nothing I can find tries to put this stuff in classes, which makes it even harder to determine what really should go in the class files themselves. I really just can't find an example that I have been able to get to work for my purpose, nor figure this out on my own.
I'm trying to create a game that involves rolling a dice. When I load the program and click the btnRoll button, the dice works fine and stops after a random number (between 10 and 20) of face changes. It then records the score in the a new line in a ListBox. Only problem is, when I press the roll button again, the face only changes once before recording the result.
I have tried creating a separate program that simply rolls the dice without recording the result, and it works fine. So I used roughly the same code in my game, but it still won't work. I have tried looking online for help for a few days now, so I figured this would be a good time to ask here.[code]...
I need to make a program in VB but I have absolutely no idea what to do or how to write the code for it.The program needs to roll 2 dice comprised of picture boxes (one large picture box with 7 small picture boxes inside it for each) add the two numbers together and then calculate the percentage of each total number per roll.
I'd just like to say please bear with me. I'm a total newbie to coding. I know a little bit of web development but I'm incredibly new to making programs. Teach me and I'll get better, I promise.
I am new to this forum. Please let me know if there is a similar thread i should look at first.I'm working on a dice game and i'm kinda stuck on how to accumulate scores. I have been able to successfully create the rolling of the dice through a function shown below;
For a class project (online course, no instructor handy to get a quick reply from -_-) we are to write a short program using classes and OOP to roll a pair of 6-sided dice 1000 times and count the number of times the total of the two dice is 7. Easy enough, and I've read over a few examples that people have written, but they don't seem to use OOP. I'm not asking you guys to do my homework for me, but I am terribly lost when it comes to using OOP. So far I understand that I should be using a Random() class object to determine the roll itself, and then maybe load each roll into an array and use a loop to check if each element is 7 or not, and then increment a counter? How do I set the range of Random() so my dice rolls are representative of a 6 sided die? It's all a bit overwhelming and I'm not sure what I should do next.
First let me say yes this is for homework and no, I DO NOT want an answer in code. A simple nudge in the correct direction will suffice.Basically I am attempting to roll the dice with the roll button and then display the number of times a number shows up with a bar graph.
I have a function that checks for wich dice have been rolled and scores them up in the correct boxes, now i want to be able to check the combined scores to see if they equal upto a full house. [code] and then listing every other possible combination, would there be a simpler way of doing it?
So my question is, I'm wiriting a VERY basic dice rolling program for my computer programming class in high school. I'm using a randomize function to generate numbers but I only want it to do numbers 1 - 6....how do I do this?
Dim x As Integer Randomize() x = CInt(10 * Rnd())
Dim Y As Integer Randomize() Y = CInt(10 * Rnd())
That is my code for my x and y (each die) to generate code, but how do I make it do 1 - 6 ONLY? Develope a game that in which a player rolls two dice. Each die has 6 faces. Each face contains 1, 2,3,4,5,6 after the dice have come to rest the sum of the spots is calculated, if the sum is 7 or 12 on the first throw, the player wins. If the sum is 2,3, or 11 on the first throw, the player loses, and the house wins. If the sum is 4,5,6,8,9,10 on the first throw the sum becomes the player's point. To win, a player must roll the dice until the plater rolls the point value. The player loses by rolling a 7 before rolling the point. I also have another question, How would I set this up to keep up with points and stuff? and the part that says "The player loses by rolling a 7 before rolling the point." I have no clue what to do on that. I'm not asking for code hand outs. I'm just asking what functions and such I'd use to write the code.
I'm using VB2008 express. idea for a D&D application. So I wrote something and it works, but it's not coded like I want. Here's the program if you want to see it in operation: [URL]
Here's the problem I have. I want a message box to pop up if no dice are selected and the user clicks the roll button. So far the only way I have been able to accomplish this is to put the same code under each radio button:
I want to have this code only once. But If I put it outside of the If/Then bracket and no dice are selected, the msgbox pops up but also the buttons that I want to remain hidden until dice are chosen pop up. How do I get the msg box to pop up and stop...don't execute any more code.
Heres' the code so far. trying to keep it relatively simple:
Code: Private Sub RollButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RollButton.Click 'see which radio button is checked and display random number accordingly If TwentySidedRadioButton.Checked Then RolledValueTextBox.Text = GenerateRandom.Next(1, 20)
I am trying to create a Random Number Generator (dice roller) that will dump its results into an open chat window. I was lead towards using DDE but have never used it before. Is this the best method? if not, What is?
I need to create a program that rolls a dice a user generated number of times and give the frequencies of the numbers that come up.I cannot for the life of me figure out how to get the frequencies?
On programming assignment without having any real experience in vb. I guess I don't understand subroutines that well. When the program runs it never goes to the computer's turn and does not update the users score either. This assignment is already in but would like to know what is going wrong. Using VB 2010, and this is windows application.
Code: Public Class Form1 Dim Myturn As Integer Dim Computerturn As Integer
If I'm making an application using two dice images and the button I click changes those two images to random dice - what is the code for that? I have already made my dice images using paint, what is the code I use so that whenever I click the "Roll the Dice" button, it goes to two random dice images?
I've seen several questions come up about making a program to "toss dice", so I thought that I'd add a few resources that those interested might find helpful:
[url]...
I put them together and hope that others might find some use from them. I might could also do something in 3D but that'd take a while!
As an example of the images, here are two screenshots of a little program I did to show them