Red rectangle the orbit the center in a circular motion. A lot of potential for different kinds of games. Remember nes mario games..
from math import * from random import * from random import randint as RAND from kandinsky import * from kandinsky import fill_rect as FILL from kandinsky import draw_string as STR from ion import * from time import sleep S_W = 320 S_H = 222 px=40 pw=12 ph=22 py=gy-ph pc=(0,0,255) pe=45 gx=0 gy=170 gw=S_W gh=5 gc=(255,)*3 gy=170 gw=320 rect_w = 20 rect_h = 20 rect_c = (255,0,0) center_x = #S_W // 2 center_y = #S_H // 2 radius = 40 angle = 0 angular_speed = 0.02 # Adjust this for speed of rotation game=True bg=(RAND(0,80),RAND(0,80),RAND(0,80)) FILL(0,0,S_W,S_H,bg) FILL(gx,gy,gw,gh,gc) while game: FILL(15,5,int(pe),8,(255,0,0)) x = center_x + int(radius * cos(angle)) y = center_y + int(radius * sin(angle)) FILL(px,py,pw,ph,pc) FILL(px,py,1,ph,("white") FILL(px+pw-1,py,1,ph,"white") FILL(px,py,pw,1,"white") FILL(px,py+ph-1,pw,1,"white") FILL(x - rect_w // 2, y - rect_h // 2, rect_w, rect_h, rect_c) FILL((x - rect_w // 2)+3, (y - rect_h // 2)+3, rect_w-6, rect_h-6, (RAND(50,255),0,0)) angle += angular_speed sleep(0.01) FILL(x - (rect_w // 2) -1, y - (rect_h // 2) -1, rect_w+2, rect_h+2, bg) if keydown(KEY_LEFT): FILL(px+pw+1,py,2,ph,bg) px-=2 FILL(15+int(pe),5,1,8,bg) pe-=0.8 if keydown(KEY_RIGHT): FILL(px-2,py,2,ph,bg) px+=2 FILL(15+int(pe),5,1,8,bg) pe-=0.8 if px+pw<0: px=S_WIDTH if px>S_WIDTH: px=-pw if keydown(KEY_UP) or keydown(KEY_OK) and pe>0: FILL(15+int(pe),5,1,8,bg) FILL(px,py+ph,pw,1,bg) py-=1 pe-=0.4 else: py+=1 if not keydown(KEY_UP) and not keydown(KEY_OK): FILL(px,py-1,pw,1,bg) if py+ph-1>gy: py=gy-ph+1 if keydown(KEY_DOWN) and py+ph>=gy: ph=10 FILL(px,py,pw,ph,bg) sleep(0.01) py=gy-ph else: ph=22 pe+=0.05 if pe>55: pe=55 if pe<0: pe=0 game=False FILL(lavax,lavay,lavaw,lavah,lavac) FILL(lavax+2,lavay+5,lavaw-4,lavah,(RAND(150,255),0,0)) STR("E",2,2,(0,255,0),bg) bg=(0,0,0) FILL(0,0,S_W,S_H,bg) STR("GAME OVER",100,100,(255,0,0),(0,0,0))