Background(228);
RectMode(RectModes.Corner);
Rect(0, 0, 100, 100);
Fill(0);
Circle(50, 50, 25);
DrawDice(20, 40);
void DrawDice(double x, double y)
{
Background(228);
RectMode(RectModes.Corner);
Rect(x, y, 100, 100);
Fill(0);
Circle(50+x, 50+y, 25);
}
Timer = Draw;
void Draw()
{
DrawDice(MouseX, MouseY);
}
void DrawDice(double x, double y)
{
Background(228);
RectMode(RectModes.Corner);
Rect(x, y, 100, 100);
Fill(0);
Circle(50+x, 50+y, 25);
}
Background(228);
DrawDice(0,0,1);
DrawDice(100,0,2);
DrawDice(200,0,3);
DrawDice(300,0,4);
DrawDice(400,0,5);
DrawDice(500,0,6);
void DrawDice(double x, double y, double points)
{
Fill(255, 0); // 0 = transparent, otherwise white
RectMode(RectModes.Corner);
Rect(x, y, 100, 100);
Fill(0);
if(points == 1)
{
Circle(100/2+x, 100/2+y, 20);
}
else if(points == 2)
{
Circle(100/4+x, 100/4+y, 20);
Circle(100/4+50+x, 100/4+50+y, 20);
}
else if(points == 3)
{
DrawDice(x, y, 1);
DrawDice(x, y, 2);
}
else if(points == 4)
{
DrawDice(x, y, 2);
Circle(100/4+50+x, 100/4+y, 20);
Circle(100/4+x, 100/4+50+y, 20);
}
else if(points == 5)
{
DrawDice(x, y, 1);
DrawDice(x, y, 4);
}
else if(points == 6)
{
DrawDice(x, y, 4);
Circle(100/4+50+x, 100/2+y, 20);
Circle(100/4+x, 100/2+y, 20);
}
}
Background(228);
Timer = Draw;
double points = Random(1, 6);
points = Math.Floor(points);
void Draw()
{
Background(228);
if(MouseIsPressed)
{
points = Random(1, 6);
points = Math.Floor(points);
PrintLn(points);
}
DrawDice(MouseX, MouseY, points);
}
void DrawDice(double x, double y, double points)
{
Fill(255, 0); // 0 = transparent, otherwise white
RectMode(RectModes.Corner);
Rect(x, y, 100, 100);
Fill(0);
if(points == 1)
{
Circle(100/2+x, 100/2+y, 20);
}
else if(points == 2)
{
Circle(100/4+x, 100/4+y, 20);
Circle(100/4+50+x, 100/4+50+y, 20);
}
else if(points == 3)
{
DrawDice(x, y, 1);
DrawDice(x, y, 2);
}
else if(points == 4)
{
DrawDice(x, y, 2);
Circle(100/4+50+x, 100/4+y, 20);
Circle(100/4+x, 100/4+50+y, 20);
}
else if(points == 5)
{
DrawDice(x, y, 1);
DrawDice(x, y, 4);
}
else if(points == 6)
{
DrawDice(x, y, 4);
Circle(100/4+50+x, 100/2+y, 20);
Circle(100/4+x, 100/2+y, 20);
}
}