Create a program using integers and shapes
Author |
Message |
Miko99
|
Posted: Tue Apr 01, 2003 11:05 am Post subject: Create a program using integers and shapes |
|
|
create a program that will simulate the roll of a dice so that when it is run it will show a square with little circles in it that represent the side of the dice that is rolled. i.e. If a 3 is rolled there will be a square on the screen with 3 circles in it. Don't worry about getting the circles in the exact location as a real die. Even if you just put the circles in a straight line in the square would be good enough for now. |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
Tony

|
Posted: Tue Apr 01, 2003 12:30 pm Post subject: (No subject) |
|
|
you should take a look at Catalyst's 3D engine. I belive he posted some of his source code - take a look at that. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
 |
Delta

|
Posted: Tue Apr 01, 2003 12:51 pm Post subject: Try something like this |
|
|
Just create an if statement that takes the value of the roll and draws 1,2,3...so on circles.
example roll
var roll : int := Rand.Int (1,6)
roll = 3
if roll=3 then
draw the following
_______
| O O O |
| |
|______|
if roll = 5 then
draw the following
_______
| O O O |
| O O |
|______|
simple if statements would be the easiest but they may take up quite
a few lines of code if you choose to draw circle by circle. You should learn
for loops
The box is suspose to be a die  |
|
|
|
|
 |
|
|