Advertisement
Nojus_Globys

dec21-football

Jan 11th, 2023 (edited)
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.15 KB | Software | 0 0
  1. int
  2.   // ball
  3.   x, y,
  4.   speed,
  5.   size,
  6.  
  7.   // gates
  8.   w, // half width
  9.   h, // half height
  10.   angle,
  11.   weight;
  12.  
  13.   int points;
  14.  
  15. void setup () {
  16.   size (1280, 740);
  17.   rectMode (CENTER);
  18.  
  19.   // ball
  20.   x = width / 2;
  21.   y = height;
  22.   speed = -(height / 50);
  23.   size = height / 20;
  24.  
  25.   // gates
  26.   w = width / 6; // half width
  27.   h = width / 10; // half height
  28.   weight = width / 60;
  29.   angle = w / 4;
  30. }
  31.  
  32. void ball () {
  33.   y += speed;
  34.  
  35.   if (y < 0) {
  36.     y = height;
  37.     x = int (random (0, width));
  38.   }
  39.  
  40.   //y = height / 2;
  41.  
  42.   noStroke ();
  43.   fill (255);
  44.   //circle (x, y, height / 10); // kamuolys
  45.  
  46.   // dėžutė
  47.   noStroke ();
  48.   fill (255, 0, 0); // raudona
  49.   square (x, y, size * 2);
  50.  
  51.   // juosta
  52.   stroke (255, 215, 0); // geltona
  53.   strokeWeight (weight / 2);
  54.   line (x - size, y, x + size, y);
  55.   //line (x - height / 20, y, x + height / 20, y);
  56.   // size = height / 20;
  57.   line (x, y - size, x, y + size);
  58.  
  59.   // kaspinas
  60.   noFill ();
  61.   circle (x - size / 3, y - size * 1.25, size / 2);
  62.   circle (x + size / 3, y - size * 1.25, size / 2);
  63. }
  64.  
  65. void draw () {
  66.   background (125, 255, 125);
  67.   ball ();
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement