SHARE
TWEET

Untitled

a guest Oct 21st, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var LIGHT_RADIUS = 35;
  2. var STOPLIGHT_WIDTH = 120;
  3. var STOPLIGHT_HEIGHT = 350;
  4. var DIST_BETWEEN_LIGHTS = 100;
  5. var GRAY_COLOR = "#737071";
  6.  
  7. function start(){
  8.     var stoplight = new Rectangle(STOPLIGHT_WIDTH, STOPLIGHT_HEIGHT);
  9.     stoplight.setColor(GRAY_COLOR);
  10.     stoplight.setPosition(getWidth()/2-60, getHeight()/2-175);
  11.     add(stoplight);
  12.    
  13.     var getX = Color.red;
  14.     var y = getHeight()/2-DIST_BETWEEN_LIGHTS;
  15.     drawCircle(LIGHT_RADIUS, getX, getWidth()/2, y);
  16.    
  17.     getX = Color.yellow;
  18.     var y = getHeight()/2;
  19.     drawCircle(LIGHT_RADIUS, getX, getWidth()/2, y);
  20.    
  21.     getX = Color.green;
  22.     var y = getHeight()/2+DIST_BETWEEN_LIGHTS;
  23.     drawCircle(LIGHT_RADIUS, getX, getWidth()/2, y);
  24. }
  25.  
  26. function drawCircle(radius, getX, x, y){
  27.     var circle = new Circle(radius);
  28.     circle.setColor(getX);
  29.     circle.setPosition(x, y);
  30.     add(circle);
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top