SHARE
TWEET

Untitled

a guest Feb 26th, 2020 128 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import stddraw
  2.  
  3. xc = .2
  4. yc = .4
  5. vx = .01
  6. vy = .02
  7.  
  8. while True:
  9.     stddraw.clear()
  10.     line1 = stddraw.line(.25, .25, .5, .75)
  11.     line2 = stddraw.line(.5, .75, .75, .25)
  12.     line3 = stddraw.line(.25, .25, .75, .25)
  13.     stddraw.point(xc, yc)
  14.     stddraw.show()
  15.     stddraw.show(10)
  16.     if (xc + vx) >= line1 or (xc + vx) <= line2 or (xc + vx) >= line3:
  17.         vx = -vx
  18.     if (yc + vy) >= line1 or (yc + vy) <= line2 or (yc + vy) >= line3:
  19.         vy = -vy
  20.     xc = xc + vx
  21.     yc = yc + vy
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