Rotating Dice
-
I am building a dice game, with rotating dice. The dice will have 1-6 dots on each side. I am also building a class to play the game, but can't figure out how to send a message to roll the dice in the class without the class knowing about the simulating rolling dice, how is this done?:confused: I am avidly interested in graphics and ado.net
-
I am building a dice game, with rotating dice. The dice will have 1-6 dots on each side. I am also building a class to play the game, but can't figure out how to send a message to roll the dice in the class without the class knowing about the simulating rolling dice, how is this done?:confused: I am avidly interested in graphics and ado.net
Some code samples would be helpful. Since we can't see your design, there is no way we can tell you what your doing right or wrong. RageInTheMachine9532
-
Some code samples would be helpful. Since we can't see your design, there is no way we can tell you what your doing right or wrong. RageInTheMachine9532
-
First, what do you mean by "roll the dice in the class without the class knowing about the simulating rolling dice"? Does this mean that you have 2 seperate classes, something that is displaying graphics dice and something else that actually picks the numbers that the dice will show? Is this a user control you've written to display the dice? RageInTheMachine9532
-
First, what do you mean by "roll the dice in the class without the class knowing about the simulating rolling dice"? Does this mean that you have 2 seperate classes, something that is displaying graphics dice and something else that actually picks the numbers that the dice will show? Is this a user control you've written to display the dice? RageInTheMachine9532
class dice dim adie1 as int16 dim adie2 as int16 property die1 as int16 get return adie1 end get set sdie1=value end set 'What I am trying to is to make sure that the class is self-contained' ' it can roll the die on the form and count the value of the die private function count_die (die1 as int16, die2 as int 16)as int16 dim total as int16 total=die1+die2 return total public sub getFirstRoll (die1 as int16, die2 as int16)as int16<-- returns array dim firstroll()as int16 redim firstroll(rolls) firstroll(rolls)= count_die(die1,die2) rolls=rolls+1 return firstroll 'test rolls! I am avidly interested in graphics and ado.net
-
I am building a dice game, with rotating dice. The dice will have 1-6 dots on each side. I am also building a class to play the game, but can't figure out how to send a message to roll the dice in the class without the class knowing about the simulating rolling dice, how is this done?:confused: I am avidly interested in graphics and ado.net
Heres some code that may point you in the right direction. It is Airware so the syntax will not be correct:-
Class DiceDisplay
Property Display as PictureBox
Property NoOfDice as int16
Property Pips as int16
Public Sub RollEm
Dim Roller as DiceRoller(NoOfDice, Pips)
Roller.Roll
DrawDice(Roller)
End Function
Public Sub DrawDice(ByRef Results as DiceRoller)
Dim Index as Int16
For Index = 1 to NoOfDice
DrawDiceImage(Roller.Results(Index))
Next Index
End sub
End Class
Class DiceRoller
Property Results as arraylist
Public Sub Roll(ByVal NoOfDice as int16, ByVal Pips as int16)
Dim Index as int16
For Index = 1 to NoOfDice
Results.Add(convert.toint16(rnd(Pips)))
Next Index
End Sub
End ClassDefinitely a PEBCAK! (Problem Exists Between Keyboard And Chair) My first ASP.Net site is now up :-O http://www.redravenrpg.com
-
class dice dim adie1 as int16 dim adie2 as int16 property die1 as int16 get return adie1 end get set sdie1=value end set 'What I am trying to is to make sure that the class is self-contained' ' it can roll the die on the form and count the value of the die private function count_die (die1 as int16, die2 as int 16)as int16 dim total as int16 total=die1+die2 return total public sub getFirstRoll (die1 as int16, die2 as int16)as int16<-- returns array dim firstroll()as int16 redim firstroll(rolls) firstroll(rolls)= count_die(die1,die2) rolls=rolls+1 return firstroll 'test rolls! I am avidly interested in graphics and ado.net
If you have a visual component that display rotating dice, you might want to consider building your class into a UserControl (Windows Control Library). That way, you can put your dice logic and visual elements in one place instead of having to worry about synchronizing two seperate classes. RageInTheMachine9532