Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void setup() {
- size(displayWidth, displayHeight ) ;
- orientation(LANDSCAPE) ;
- noStroke() ;
- textFont(createFont("Arial", 200));
- }
- int px = 860;
- int py = 440;
- float ok = -15;
- int ok1 = 0;
- int ok2 = 0;
- int text = 200;
- int cx = 1830;
- int cx1 = 1830;
- int cx2 = 1830;
- int cx3 = 1830;
- int cx4 = 1830;
- boolean jump = false;
- boolean start = true;
- boolean play = false;
- boolean dead = false;
- void draw() {
- fill(0, 0, 100);
- rect(0, 0, displayWidth, displayHeight ) ;
- fill(0,0,200);
- rect(random(0,1870),random(0,490),50,50);
- rect(random(0,1870),random(0,490),50,50);
- rect(random(0,1870),random(0,490),50,50);
- fill(10,25,35);
- rect(0, 540, displayWidth, 540);
- fill(7,20,30);
- rect(0,640,displayWidth, 440);
- fill(5,15,20);
- rect(0,740,displayWidth, 340);
- fill(3,10,15);
- rect(0,840,displayWidth, 240);
- fill(1, 5,6);
- rect(0,940,displayWidth, 140);
- fill(0);
- rect(0,1040,displayWidth, 40);
- fill(44,155,173);
- rect(px, py, 100, 100);
- fill(32,191,218);
- rect(px+10,py+10,80,80);
- fill(22,207,230);
- rect(px+20,py+20,60,60);
- fill(0,227,255);
- rect(px+30,py+30,40,40);
- if (start &&! play) {
- cx1 = 1830;
- dead = false;
- px = 860;
- fill(0, 100, 100, text);
- text("START", 610, 340);
- ok1++;
- if (ok1 ==25) {
- if (text ==0) {
- text = 200;
- } else {
- text = 0;
- }
- ok1 = 0;
- }
- if (mouseX >=600 && mouseX <= 1280 && mouseY <=350 && mouseY >=150) {
- start = false;
- play = true;
- cx = 1830;
- }
- }
- if (play) {
- fill(71, 0, 255);
- rect(cx, 490, 50, 50) ;
- cx-=10;
- if (cx <= 1000) {
- fill(133,0,0);
- rect(cx1, 440, 100, 100);
- cx1-=10;
- if (px+100>=cx1 && px+100<=cx1+100 && py<=440) {
- if (! mousePressed) {
- jump = false;
- }
- }
- if(py+100>=441&&px+100>cx1&&px+100<=cx1+100){
- dead = true;
- }
- if (px>=cx1+100 && py<=440 && py<=859 && ! jump) {
- py+=10;
- }
- }
- if ((px >= cx && px <= cx+50 && py+100>=490) || (px +100>= cx && px +100<= cx+50 && py + 100>=490) ) {
- dead = true;
- play = false;
- }
- if(cx1<=1650){
- fill(0) ;
- rect(cx2, 400,100,140);
- fill(71,0,255);
- rect(cx2+20,410,60, 120);
- cx2-=10;
- if(((px+90 >= cx2 && px +100 <= cx2+100)||(px<=cx2+100 && px >= cx2)) && py +100 >= 400){
- dead = true;
- play = false;
- }
- }
- }
- if (dead) {
- start = true;
- play = false;
- cx = 1880;
- py = 440;
- cx1 = 1830;
- cx2 = 1830;
- }
- if (mousePressed) {
- jump = true;
- }
- if (jump) {
- py+=ok;
- ok+=1;
- if (py>=440) {
- ok = -15.0;
- jump = false;
- }
- }
- else{
- ok = - 15;
- }
- if(py>440){
- py = 440;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement