Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PImage zirkles, sulinys, popierius;
- int chose = 0;
- int other ;
- float k = random(0,3);
- int screen = 0;
- float lauk = 0;
- void setup()
- {
- size(600,600);
- zirkles = loadImage("zirkles.png");
- popierius = loadImage("popierius.png");
- sulinys = loadImage("sulinys.png");
- background(25);
- }
- void draw()
- {
- if(screen == 0)
- {
- if (chose == 0)
- {
- image(zirkles, 50, height-200);
- image(popierius, 250, height-200);
- image(sulinys, 450, height-200);
- }
- else
- {
- {
- if(chose == 1)
- {
- image(zirkles, 250, 400);
- }
- if(chose == 2)
- {
- image(popierius, 250, 400);
- }
- if(chose == 3)
- {
- image(sulinys, 250, 400);
- }
- if(k < 1)
- {
- image(zirkles, 250, 100);
- other = 1;
- }
- if(k > 1 && k < 2)
- {
- image(popierius, 250, 100);
- other = 2;
- }
- if(k > 2)
- {
- image(sulinys, 250, 100);
- other = 3;
- }
- lauk = millis();
- if(lauk > 7000)
- {
- if(other == chose)
- {
- screen = 1;
- }
- if(other == 1 && chose == 2 || other == 2 && chose == 3 ||
- other == 3 && chose == 1)
- {
- screen = 2;
- }
- if(other == 2 && chose == 1 || other == 3 && chose == 2 ||
- other == 1 && chose == 3)
- {
- screen = 3;
- }
- }
- }
- }
- if (screen == 1)
- {
- background(0);
- fill(255);
- textSize(50);
- textAlign(CENTER, CENTER);
- text("Tie", width/2, height/2);
- }
- if (screen == 2)
- {
- background(0);
- fill(255);
- textSize(50);
- textAlign(CENTER, CENTER);
- text("Enemy wins", width/2, height/2);
- }
- if (screen == 3)
- {
- background(0);
- fill(255);
- textSize(50);
- textAlign(CENTER, CENTER);
- text("You win", width/2, height/2);
- }
- }
- }
- void mousePressed()
- {
- if(mouseY > 400 && mouseY < 500)
- {
- if(mouseX > 50 && mouseX < 150 )
- {
- chose = 1;
- }
- if(mouseX > 250 && mouseX < 350 )
- {
- chose = 2;
- }
- if(mouseX > 450 && mouseX < 550 )
- {
- chose = 3;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement