Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int Dice1;
- int Dice2;
- int Dice3;
- IntList DiceList;
- int DiceSize = 160;
- int PointSize = 20;
- void setup() {
- size(800, 400);
- surface.setTitle("Jeu du 421 - Such WOW");
- background(0, 153, 0);
- noLoop();
- DiceList = new IntList();
- }
- void draw() {
- DisplayDice();
- Randomizer();
- DisplayNumber();
- DiagnosticVoid();
- }
- void DiagnosticVoid(){
- print(DiceList);
- }
- void DisplayDice() {
- generateDice(200, 200, DiceSize);
- generateDice(400, 200, DiceSize);
- generateDice(600, 200, DiceSize);
- }
- void generateDice(int XLocation, int YLocation, int SquareSize) {
- rectMode(CENTER);
- fill(255);
- rect(XLocation, YLocation, SquareSize, SquareSize, 7);
- }
- void Randomizer() {
- Dice1 = int(random(1, 6));
- Dice2 = int(random(1, 6));
- Dice3 = int(random(1, 6));
- DiceList.append(Dice1);
- DiceList.append(Dice2);
- DiceList.append(Dice3);
- DiceList.sort();
- }
- void DisplayNumber() {
- dispFace(200, 200, DiceSize, Dice1);
- dispFace(400, 200, DiceSize, Dice2);
- dispFace(600, 200, DiceSize, Dice3);
- }
- void dispFace(int XLocation, int YLocation, int DiceSize, int DiceValue) {
- switch(DiceValue) {
- case 1:
- Disp1(XLocation, YLocation);
- break;
- case 2:
- Disp2(XLocation, YLocation);
- break;
- case 3:
- Disp1(XLocation, YLocation);
- Disp2(XLocation, YLocation);
- break;
- case 4:
- Disp2(XLocation, YLocation);
- Disp4(XLocation, YLocation);
- break;
- case 5:
- Disp1(XLocation, YLocation);
- Disp2(XLocation, YLocation);
- Disp4(XLocation, YLocation);
- break;
- case 6:
- Disp2(XLocation, YLocation);
- Disp4(XLocation, YLocation);
- Disp6(XLocation, YLocation);
- break;
- }
- }
- void Disp1(int XLocation, int YLocation) {
- fill(0);
- ellipse(XLocation, YLocation, PointSize, PointSize);
- }
- void Disp2(int XLocation, int YLocation) {
- fill(0);
- ellipse(XLocation+int(0.25*DiceSize), YLocation-int(0.25*DiceSize),PointSize, PointSize);
- fill(0);
- ellipse(XLocation-int(0.25*DiceSize), YLocation+int(0.25*DiceSize), PointSize, PointSize);
- }
- void Disp4(int XLocation, int YLocation) {
- fill(0);
- ellipse(XLocation+int(0.25*DiceSize), YLocation+int(0.25*DiceSize), PointSize, PointSize);
- fill(0);
- ellipse(XLocation-int(0.25*DiceSize), YLocation-int(0.25*DiceSize), PointSize, PointSize);
- }
- void Disp6(int XLocation, int YLocation) {
- fill(0);
- ellipse(XLocation+int(0.25*DiceSize), YLocation, PointSize, PointSize);
- fill(0);
- ellipse(XLocation-int(0.25*DiceSize), YLocation, PointSize, PointSize);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement