Advertisement
Nojus_Globys

dec14-football

Dec 21st, 2022 (edited)
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | Software | 0 0
  1. int
  2.   // ball
  3.   x, y,
  4.   speed,
  5.  
  6.   // gates
  7.   w, // half width
  8.   h, // half height
  9.   angle,
  10.   weight;
  11.  
  12.   int points;
  13.  
  14. void setup () {
  15.   size (1280, 740);
  16.   rectMode (CENTER);
  17.  
  18.   // ball
  19.   x = width / 2;
  20.   y = height;
  21.   speed = -(height / 50);
  22.  
  23.   // gates
  24.   w = width / 6; // half width
  25.   h = width / 10; // half height
  26.   weight = width / 60;
  27.   angle = w / 4;
  28. }
  29.  
  30. void ball () {
  31.   y += speed;
  32.  
  33.   if (y < 0) {
  34.     y = height;
  35.     x = int (random (0, width));
  36.   }
  37.  
  38.   noStroke ();
  39.   fill (255);
  40.   circle (x, y, height / 10); // kamuolys
  41. }
  42.  
  43. void draw () {
  44.   background (125, 255, 125);
  45.   ball ();
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement