# planeur_bombe0.py

Created by florian-allard

Created on March 14, 2021

1.36 KB

Version monochrome du jeu BombRun. La version couleur est disponible ici.

```from random import randint
from kandinsky import get_pixel,draw_string,fill_rect
from ion import *
from time import sleep

while 1:
draw_string("EXE pour lancer une partie",30,100,(160,0,255))
while keydown(KEY_EXE) or keydown(KEY_OK):True
while not (keydown(KEY_EXE) or keydown(KEY_OK)):True
fill_rect(0,0,319,221,'white')
for a in range(31+1):
c=randint(1,12)
for b in range(c+1):
draw_string("œ",10*a,207-14*c+14*b,'blue')

x=0
y=10
drop=False

while y<10+14*14:
x+=10
if x>310:
x=0
y+=14
if (x<310 and get_pixel(x+15,y+7) != (248,252,248)) or (x==310 and get_pixel(0+5,y+14+7) != (248,252,248)):
draw_string("C'est perdu, ça a touché !",30,80,"red")
break
draw_string(">",x,y-1,'green')
k=0
for k in range(15):
if (keydown(KEY_EXE) or keydown(KEY_OK)) and not drop:
bx=x
by=y
drop=True
sleep(0.01)
if drop:
draw_string(" ",bx,by)
by+=14
if get_pixel(bx+5,by+7) != (248,252,248): #s'il y a un immeuble
for etage in range(by,210,14): #alors on l'efface
draw_string(" ",bx,etage)
drop=False
elif by<210: #sinon la bombe descend
draw_string("°",bx-1,by,'red')
else:
drop=False
if y>10+13*14:
draw_string("C'est gagné, bravo !!",55,80)
draw_string(" ",x,y-1)```