Will improve frequently.
from math import * from random import * from random import randint as RAND from kandinsky import * from kandinsky import fill_rect as F from ion import * from time import * RED=(255,0,0) WHITE=(255,)*3 BLACK=(0,)*3 GREEN=(0,255,0) CYAN=(0,255,255) bg=WHITE GAME_OVER=False float_energy=30 times_almost_fell=0 traveled=0 score=0 life=3 x=15 y=30 w=RAND(13,16) h=RAND(12,20) c=(RAND(0,255),RAND(0,255),RAND(0,255)) fill_rect(0,200,322,25,(255,0,0)) base=[0,randint(60,120),50,5,(0,0,0)] while not GAME_OVER: fill_rect(*base) fill_rect(100,120,60,5,BLACK) fill_rect(x,y,w,h,c) fill_rect(x+3,y+3,4,3,BLACK) fill_rect(x+9,y+3,4,3,BLACK) if keydown(KEY_LEFT): x-=1 fill_rect(x+w+1,y,1,h,WHITE) if keydown(KEY_RIGHT): x+=1 fill_rect(x-1,y,1,h,WHITE) if keydown(KEY_UP) and float_energy>0 or keydown(KEY_BACKSPACE) and float_energy>0: y-=2 fill_rect(230,4,int(float_energy),13,WHITE) float_energy-=0.4 fill_rect(x,y+h+1,w,1,(255,)*3) if get_pixel(120,120)==(0,0,255): draw_string("lava!",20,1) if get_pixel(x,y+h+2) == (255,0,0) and get_pixel(x+w,y+h-1) == (255,0,0): sleep(0.25) fill_rect(x,y,w,h,(255,)*3) x=15 y=30 life-=1 if life<1: sleep(0.4) fill_rect(0,0,322,222,(0,0,0)) sleep(1) draw_string("GAME OVER",100,80,(255,0,0),(0,0,0)) sleep(1) draw_string("Score:"+str(score),100,130,WHITE,(0,0,0)) sleep(1.5) draw_string("PRESS [OK]",120,180,BLACK,GREEN) GAME_OVER=True if get_pixel(x,y+h) != (0,0,0) and get_pixel(x+w,y+h) != (0,0,0): sleep(0.001) y+=1 fill_rect(x-1,y-1,w+2,1,(255,)*3) if get_pixel(x,y+h) == (0,0,0) and get_pixel(x+w,y+h) == (0,0,0): float_energy=30 if y<0: y=0 if x+w<-1: x=322 if x>322: x=-1-w if not GAME_OVER: draw_string("E:[",200,1) fill_rect(230,4,int(float_energy),13,(0,255,0)) print("") print("traveled:",traveled) sleep(0.2) print("times_almost_fell:",times_almost_fell)