Advertisement
Nojus_Globys

B | football

Jan 17th, 2023 (edited)
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.20 KB | Software | 0 0
  1. int
  2.   // ball
  3.   x,
  4.   y,
  5.   speed,
  6.  
  7.   // gates
  8.   w, // pusė vartų pločio
  9.   h, // pusė vartų aukščio
  10.   angle, // perpektyva // depth (gylis)
  11.   weight; // vamzdžių storis
  12.  
  13. void setup () {
  14.   size (1280, 740);
  15.   rectMode (CENTER);
  16.   //println (round (5.9));
  17.   //println (int (5.9));
  18.  
  19.   //fill (#FFFFFF);
  20.   //fill (255, 255, 255);
  21.   //circle (100, 100, 100);
  22.  
  23.   x = width / 2;
  24.   y = height;
  25.   speed = -(height / 50);
  26.  
  27.   w = width / 6;
  28.   h = width / 10;
  29.   angle = w / 4;
  30.   weight = width / 60;
  31. }
  32.  
  33. //float random (float first, float second) {
  34.  
  35. //}
  36.  
  37. void ball () {
  38.   y += speed; // * q
  39.  
  40.   if ((y < 0) || (x > mouseX - w && x < mouseX + w && y < mouseY && y > mouseY - h)) { /*arba kamuolys atsirado vartuose*/
  41.     y = height;
  42.     x = int (random (width));
  43.     ///*int*/ x = /*float*/ random (width);
  44.     //x = round (random (width));
  45.   }
  46.  
  47.   noStroke ();
  48.   fill (255);
  49.   circle (x, y, height / 10);
  50. }
  51.  
  52. void gate () { // goal
  53.   strokeWeight (weight); // linijų storis
  54.   stroke (0); // rgb // 0 - 255 // juoda
  55.   noFill ();
  56.  
  57.   rect (mouseX + angle, mouseY - angle, w * 2, h * 2, width / 500); // kampų apvalumas
  58.   //rect (mouseX, mouseY, w * 2, h * 2, width / 500); // kampų apvalumas
  59.  
  60.   //strokeWeight (1); // linijų storis
  61.   //line (pradžios taškas, pabaigos taškas);
  62.   //line (pradžios taško x, pradžios taško y, pabaigos taško x, pabaigos taško y);
  63.  
  64.   line (mouseX - w, mouseY - h, mouseX + w, mouseY - h); // priekio viršus
  65.   line (mouseX - w, mouseY - h, mouseX - w, mouseY + h); // priekio kairė
  66.   line (mouseX + w, mouseY - h, mouseX + w, mouseY + h);
  67.  
  68.   //stroke (255); // balta spalva
  69.   //line (mouseX, mouseY, mouseX, mouseY);
  70.   // šono viršaus kairė
  71.   line (mouseX - w, mouseY - h, (mouseX - w) + angle, (mouseY - h) - angle);
  72.   // šono viršaus dešinė
  73.   line (mouseX + w, mouseY - h, (mouseX + w) + angle, (mouseY - h) - angle);
  74.   // šono apačios kairė
  75.   line (mouseX - w, mouseY + h, (mouseX - w) + angle, (mouseY + h) - angle);
  76.   // šono apačios dešinė
  77.   line (mouseX + w, mouseY + h, (mouseX + w) + angle, (mouseY + h) - angle);
  78. }
  79.  
  80. void draw () {
  81.   background (125, 255, 125);
  82.   gate ();
  83.   ball ();
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement