Last active
January 5, 2021 21:50
-
-
Save MisterE123/590c7f22507928de8e171277bfab082e to your computer and use it in GitHub Desktop.
ball
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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