Skip to content

Instantly share code, notes, and snippets.

@MisterE123
Last active January 5, 2021 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MisterE123/590c7f22507928de8e171277bfab082e to your computer and use it in GitHub Desktop.
Save MisterE123/590c7f22507928de8e171277bfab082e to your computer and use it in GitHub Desktop.
ball
# Type your text here
from math import *
from kandinsky import*
scr_w = 320
scr_h = 222
ball = (5,10,-1,-1)
#this is (pos x,pos y, move x, move y)
def draw_ball(ball):
fill_rect(ball[0],ball[1],10,10,color(255,0,0))
def clrscrn():
fill_rect(0,0,scr_w,scr_h,color(255,255,255))
while True:
if ball[0] == 0 or ball[0]== scr_w:
ball[2] = -1 * ball[2]
if ball[1] == 0 or ball[1] == scr_h:
ball[3] = -1 * ball[3]
ball[0] = ball[0]+ ball[2]
ball[1] = ball[1] +ball[3]
clrscrn()
draw_ball(ball)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment