chrome_dino.py

Created by diegokhelladi

Created on February 12, 2026

14.4 KB

La réplique la plus parfaite du jeu original « Chrome Dino ». Parcourrez un monde rempli de cactus et de ptérodactyles, avec une vitesse progressive et une difficulté redoutable.

Ce script est une version minimaliser.

Changelog : Version 1.00

Propriété intellectuelle :

Copyright (c) 2026 Diégo KHELLADI Tous droits réservés. Ce programme est mis à disposition uniquement pour le téléchargement et utilisation sur une calculatrice NumWorks à des fins personnelles. Toute copie, modification ou redistribution est interdite sans autorisation écrite. Pour toute question, veuillez vous adresser à : diegokhelladi@gmail.com

Ce programme est une création indépendante. “Chrome Dino” est une marque et un jeu appartenant à Google LLC. Ce projet n’est ni affilié ni approuvé par Google.

NumWorks est une marque déposée appartenant à NumWorks SAS. Ce programme n’est pas affilié ni approuvé par NumWorks.


from kandinsky import*
from ion import*
from time import sleep
from random import randint
x=20
y=190
ground=190
score=0
hi=0
tmp=0
pause=0
y_velocity=0
gravity=2
jump_force=-13
anim_frame=0
elapsed_frames=0
difficulty_level=0
cactus_list=[]
frame_count=0
next_cactus_delay=randint(30,50)
bird_list=[]
frame_count_bird=0
next_bird_delay=randint(30,50)
nuage_list=[]
frame_count_nuage=0
next_nuage_delay=randint(30,70)
sol_list=[]
frame_count_sol=0
next_sol_delay=randint(1,2)
roche_list=[]
frame_count_roche=0
next_roche_delay=randint(30,50)
cactus_speed=min(14,10+difficulty_level//3)
bird_speed=min(14,10+difficulty_level//3)
roche_speed=min(14,10+difficulty_level//3)
sol_speed=min(14,10+difficulty_level//3)
nuage_speed=min(14,5+difficulty_level//3)
player=[(11,-12,8,1),(10,-11,10,1),(13,-10,7,1),(10,-10,2,1),(10,-9,10,3),(10,-6,5,1),(10,-5,8,1),(9,-4,5,1),(0,-4,1,1),(7,-3,7,1),(0,-3,1,1),(6,-2,10,1),(0,-2,2,1),(15,-1,1,1),(5,-1,9,1),(0,-1,3,1),(0,0,14,1),(1,1,12,1),(2,2,11,1),(3,3,9,1),(4,4,7,1),(5,5,3,1),(9,5,2,1),(6,6,2,1),(9,6,1,1),(6,7,1,1),(9,7,1,1),(6,8,2,1),(9,8,2,1)]
playerpg2=[(11,-12,8,1),(10,-11,10,1),(13,-10,7,1),(10,-10,2,1),(10,-9,10,3),(10,-6,5,1),(10,-5,8,1),(9,-4,5,1),(0,-4,1,1),(7,-3,7,1),(0,-3,1,1),(6,-2,10,1),(0,-2,2,1),(15,-1,1,1),(5,-1,9,1),(0,-1,3,1),(0,0,14,1),(1,1,12,1),(2,2,11,1),(3,3,9,1),(4,4,7,1),(5,5,4,1),(10,5,1,1),(6,6,2,1),(10,6,3,1),(6,7,1,1),(6,8,2,1)]
playerpd3=[(11,-12,8,1),(10,-11,10,1),(13,-10,7,1),(10,-10,2,1),(10,-9,10,3),(10,-6,5,1),(10,-5,8,1),(9,-4,5,1),(0,-4,1,1),(7,-3,7,1),(0,-3,1,1),(6,-2,10,1),(0,-2,2,1),(15,-1,1,1),(5,-1,9,1),(0,-1,3,1),(0,0,14,1),(1,1,12,1),(2,2,11,1),(3,3,9,1),(4,4,7,1),(5,5,2,1),(9,5,2,1),(6,6,2,1),(9,6,1,1),(9,7,1,1),(9,8,2,1)]
clear_playere=[(11,-12,8,1),(10,-11,10,1),(13,-10,7,1),(10,-10,2,1),(10,-9,10,3),(10,-6,5,1),(10,-5,8,1),(9,-4,5,1),(0,-4,1,1),(7,-3,7,1),(0,-3,1,1),(6,-2,10,1),(0,-2,2,1),(15,-1,1,1),(5,-1,9,1),(0,-1,3,1),(0,0,14,1),(1,1,12,1),(2,2,11,1),(3,3,9,1),(4,4,7,1),(3,5,11,6)]
playerpg1_ac=[(0,-3,1,1),(18,-3,8,1),(0,-2,3,1),(7,-2,8,1),(17,-2,10,1),(0,-1,19,1),(20,-1,7,1),(1,0,26,1),(2,1,25,1),(3,2,24,1),(4,3,18,1),(5,4,11,1),(18,4,7,1),(6,5,5,1),(14,5,1,1),(5,6,3,1),(10,6,2,1),(14,6,2,1),(5,7,2,1),(5,8,1,1),(5,9,2,1)]
playerpd2_ac=[(0,-3,1,1),(18,-3,8,1),(0,-2,3,1),(7,-2,8,1),(17,-2,10,1),(0,-1,19,1),(20,-1,7,1),(1,0,26,1),(2,1,25,1),(3,2,24,1),(4,3,18,1),(5,4,11,1),(18,4,7,1),(6,5,5,1),(14,5,1,1),(5,6,1,1),(8,6,3,1),(14,6,2,1),(5,7,2,1),(8,7,2,1),(8,8,1,1),(8,9,2,1)]
clear_playerp_ac=[(0,-3,1,1),(18,-3,8,1),(0,-2,3,1),(7,-2,8,1),(17,-2,10,1),(0,-1,19,1),(20,-1,7,1),(1,0,26,1),(2,1,25,1),(3,2,24,1),(4,3,18,1),(5,4,11,1),(18,4,7,1),(6,5,5,1),(14,5,1,1),(5,6,3,1),(10,6,2,1),(14,6,2,1),(5,7,2,1),(5,8,1,1),(5,9,2,1),(5,6,1,1),(8,6,3,1),(14,6,2,1),(5,7,2,1),(8,7,2,1),(8,8,1,1),(8,9,2,1)]
player_big=[(33,-36,24,3),(30,-33,30,3),(39,-30,21,3),(30,-30,6,3),(30,-27,30,9),(30,-18,15,3),(30,-15,24,3),(27,-12,15,3),(0,-12,3,3),(21,-9,21,3),(0,-9,3,3),(18,-6,30,3),(0,-6,6,3),(45,-3,3,3),(15,-3,27,3),(0,-3,9,3),(0,0,42,3),(3,3,36,3),(6,6,33,3),(9,9,27,3),(12,12,21,3),(15,15,9,3),(27,15,6,3),(15,18,6,3),(30,18,3,3),(15,21,3,3),(30,21,3,3),(15,24,6,3),(30,24,6,3)]
cactus_data=[(-15,2,4,7),(-19,0,11,1),(-20,-1,13,1),(-20,-8,3,7),(-15,-13,4,15),(-9,-10,3,9),(-19,-9,1,1),(-14,-14,2,1),(-8,-11,1,1)]
nuage_data=[(0,13,2,1),(10,13,35,1),(1,12,2,1),(4,12,2,1),(9,12,1,1),(44,12,1,1),(5,11,1,1),(43,11,1,1),(5,10,1,1),(41,10,3,1),(5,9,2,1),(41,9,1,1),(6,8,8,1),(38,8,4,1),(13,7,5,1),(30,7,1,1),(38,7,1,1),(17,6,1,1),(31,6,8,1),(17,5,1,1),(31,5,1,1),(17,4,3,1),(30,4,2,1),(19,3,2,1),(30,3,2,1),(20,2,6,1),(28,2,3,1),(25,1,4,1)]
roche_data=[(0,5,1,1),(1,5,5,1),(1,4,2,1),(3,3,3,1),(6,4,1,1),(7,5,5,1),(12,6,2,1),(12,5,5,1),(14,6,3,1),(17,5,2,1),(20,5,2,1)]
clear_roche_data=[(1,5,7,1),(0,5,1,1),(1,5,5,1),(1,4,2,1),(3,3,3,1),(6,4,1,1),(7,5,5,1),(12,6,2,1),(12,5,5,1),(14,6,3,1),(17,5,2,1),(20,5,2,1)]
bird_data=[(4,0,2,1),(3,1,3,1),(2,2,5,1),(1,3,6,1),(0,4,14,1),(6,5,9,1),(7,6,14,1),(8,7,10,1),(8,8,12,1),(8,9,9,1),(8,10,4,1),(8,11,3,1),(8,12,2,1),(8,13,2,1),(8,14,1,1)]
birdp2_data=[(7,-3,1,1),(7,-2,2,1),(7,-1,3,1),(8,0,3,1),(8,1,4,1),(8,2,5,1),(8,3,6,1),(4,0,2,1),(3,1,3,1),(2,2,5,1),(1,3,6,1),(0,4,14,1),(6,5,9,1),(7,6,14,1),(8,7,10,1),(9,8,11,1),(10,9,7,1)]
bird_clear_data=[(4,0,2,1),(3,1,3,1),(2,2,5,1),(1,3,6,1),(0,4,14,1),(6,5,9,1),(7,6,14,1),(8,7,10,1),(8,8,12,1),(8,9,9,1),(8,10,4,1),(8,11,3,1),(8,12,2,1),(8,13,2,1),(8,14,1,1),(7,-3,1,1),(7,-2,2,1),(7,-1,3,1),(8,0,3,1),(8,1,4,1),(8,2,5,1),(8,3,6,1),(10,9,7,1)]
lune_data=[(0,0,6,2),(4,2,8,2),(6,4,8,2),(8,6,8,2),(10,8,8,4),(12,12,8,4),(12,12,8,14),(10,24,8,4),(8,28,8,2),(6,30,8,2),(4,32,8,2),(0,34,6,2)]
star_data=[(3,0,1,1),(0,1,1,1),(3,1,1,1),(6,1,1,1),(3,2,1,1),(2,3,3,1),(0,4,8,1),(2,5,3,1),(3,6,1,1),(0,7,1,1),(3,7,1,1),(6,7,1,1),(3,8,1,1)]
star2_data=[(3,0,1,1),(3,1,1,1),(3,2,1,1),(2,3,3,1),(0,4,8,1),(2,5,3,1),(3,6,1,1),(3,7,1,1),(3,8,1,1)]
color1=83,83,83
color2=218,218,218
colorc=255,255,255
def draw_sprite(x,y,data,color=color1):
  for(dx,dy,w,h)in data:fill_rect(x+dx,y+dy,w,h,color1)
def draw_sprite2(x,y,data):
  for(dx,dy,w,h)in data:fill_rect(x+dx,y+dy,w,h,color2)
def clear_sprite(x,y,data):
  for(dx,dy,w,h)in data:fill_rect(x+dx,y+dy,w,h,colorc)
def draw_player(x,y):draw_sprite(x,y,player)
def draw_playerpg2(x,y):draw_sprite(x,y,playerpg2)
def draw_playerpd3(x,y):draw_sprite(x,y,playerpd3)
def clear_player(x,y):fill_rect(x+11,y-12,8,1,colorc);fill_rect(x+10,y-11,10,1,colorc);fill_rect(x+13,y-10,7,1,colorc);fill_rect(x+10,y-10,2,1,colorc);fill_rect(x+10,y-9,10,3,colorc);fill_rect(x+10,y-6,5,1,colorc);fill_rect(x+10,y-5,8,1,colorc);fill_rect(x+9,y-4,5,1,colorc);fill_rect(x,y-4,1,1,colorc);fill_rect(x+7,y-3,7,1,colorc);fill_rect(x,y-3,1,1,colorc);fill_rect(x+6,y-2,10,1,colorc);fill_rect(x,y-2,2,1,colorc);fill_rect(x+15,y-1,1,1,colorc);fill_rect(x+5,y-1,9,1,colorc);fill_rect(x,y-1,3,1,colorc);fill_rect(x,y,14,1,colorc);fill_rect(x+1,y+1,12,1,colorc);fill_rect(x+2,y+2,11,1,colorc);fill_rect(x+3,y+3,9,1,colorc);fill_rect(x+4,y+4,7,1,colorc);fill_rect(x+3,y+5,11,6,colorc)
def draw_playerpg1_ac(x,y):draw_sprite(x,y,playerpg1_ac)
def draw_playerpd2_ac(x,y):draw_sprite(x,y,playerpd2_ac)
def clear_draw_playerp_ac(x,y):clear_sprite(x,y,clear_playerp_ac)
def draw_playerst(x,y):draw_sprite(x,y,player_big,(83,83,83))
def draw_cactus(x,y):draw_sprite(x,y,cactus_data)
def clear_cactus(x,y):clear_sprite(x,y,cactus_data)
def draw_nuage(x,y):draw_sprite2(x,y,nuage_data)
def clear_nuage(x,y):fill_rect(x,y,48,14,colorc)
def draw_sol(x,y):fill_rect(x,y,2,1,color1)
def clear_sol(x,y):fill_rect(x,197,2,7,colorc)
def draw_roche(x,y):draw_sprite(x,y,roche_data)
def clear_roche(x,y):clear_sprite(x,y,clear_roche_data)
def draw_bird(x,y):draw_sprite(x,y,bird_data)
def draw_birdp2(x,y):draw_sprite(x,y,birdp2_data)
def clear_bird(x,y):
  for(dx,dy,w,h)in bird_clear_data:fill_rect(x+dx,y+dy,w,h,colorc)
def draw_lune(x,y):draw_sprite2(x,y,lune_data)
def draw_star(x,y):draw_sprite2(x,y,star_data)
def draw_star2(x,y):draw_sprite2(x,y,star2_data)
def check_collision(px,py,ox,oy):return ox-20<px+14 and ox-8>px and oy-20<py and oy>py-20
def check_collision_ac(px,py,ox,oy):return ox-20<px+26 and ox-8>px and oy-20<py and oy>py-12
def check_collision_bird(px,py,bx,by):return px<bx+14 and px+30>bx and py<by+14 and py+20>by
def reset():
  global hi,score,game_over;global x,y,y_velocity,ground;global cactus_list,bird_list,nuage_list,sol_list,roche_list;global frame_count,frame_count_bird,frame_count_nuage,frame_count_sol,frame_count_roche;global next_cactus_delay,next_bird_delay,next_nuage_delay,next_sol_delay,next_roche_delay;global elapsed_frames,difficulty_level;color1=83,83,83;color2=218,218,218;colorc=255,255,255
  if hi<=score:hi=score
  draw_string(str(hi),x+20,10,color1,colorc);game_over=True;draw_string('PERDU',135,100,color1,colorc);draw_string('Appuie sur OK pour recommencer',10,120,color1,colorc);print('Ton score est de :',score);print('et ton meilleur score de :',hi,'!');print('Encore :',hi-score+1,'pt(s) de plus pour depasser ton recort !');x=20;y=ground;y_velocity=0;cactus_list=[];nuage_list=[];sol_list=[];roche_list=[];bird_list=[];frame_count=0;frame_count_bird=0;frame_count_nuage=0;frame_count_sol=0;frame_count_roche=0;elapsed_frames=0;difficulty_level=0;score=0
while True:
  sleep(.1);fill_rect(0,0,320,222,(255,255,255));draw_string('CHROME DINO',100,50,(83,83,83),(255,255,255));draw_string('Appuie sur OK pour jouer',40,70,(83,83,83),(255,255,255));draw_string('commandes:(shift)',10,200,(83,83,83),(255,255,255));draw_string('V 1.00',250,200,(83,83,83),(255,255,255));draw_playerst(x+100,y-40);fill_rect(0,195,320,1,(83,83,83))
  while not keydown(KEY_OK)and not keydown(KEY_SHIFT):sleep(.05)
  if keydown(KEY_SHIFT):fill_rect(0,0,320,222,(255,255,255));draw_string('COMMANDES :',110,30,(83,83,83),(255,255,255));draw_string('Sauter :    (OK)',80,80,(83,83,83),(255,255,255));draw_string("S'acroupir : (V)",80,110,(83,83,83),(255,255,255));draw_string('Pause :  (sprm.)',80,140,(83,83,83),(255,255,255));draw_string('Appuie sur OK pour jouer',40,165,(83,83,83),(255,255,255));draw_string('propriété intellectuelle:(exe)',10,200,(83,83,83),(255,255,255));fill_rect(0,195,320,1,(83,83,83))
  while not keydown(KEY_OK)and not keydown(KEY_EXE):
    sleep(.05)
    if keydown(KEY_EXE):fill_rect(0,0,320,222,(255,255,255));draw_string('Propriété intelectuelle :',45,30,(83,83,83),(255,255,255));draw_string('Copyright(c) 2026 Diégo KHELLADI.',0,90,(83,83,83),(255,255,255));draw_string('Tous droits reserves. ',62,120,(83,83,83),(255,255,255))
  while not keydown(KEY_OK):sleep(.05)
  if keydown(KEY_OK):fill_rect(0,0,320,222,colorc);game_over=False
  last_phase=-1
  while not game_over:
    draw_string('HI',x-10,10,color1,colorc);draw_string(str(hi),x+20,10,color1,colorc);draw_string(str(score),x+250,10,color1,colorc);fill_rect(0,195,320,1,color1);score+=1;phase=score//300%2
    if phase==0:color1=83,83,83;color2=218,218,218;colorc=255,255,255;night=False
    else:color1=172,172,172;color2=37,37,37;colorc=0,0,0;night=True
    if phase!=last_phase:fill_rect(0,0,320,222,colorc);last_phase=phase
    if night:draw_lune(50,90);draw_star(100,100);draw_star2(20,110);draw_star(60,40);draw_star2(140,20);draw_star(130,75);draw_star2(60,140);draw_star(260,120);draw_star2(180,90);draw_star(220,70);draw_star2(280,60);draw_star(250,20);draw_star2(160,110)
    min_distance=130+difficulty_level*4+randint(0,60);min_delay=max(20,frame_count//2-difficulty_level);max_delay=min_delay+40+randint(0,20);spawn_chance=randint(1,4)
    if len(cactus_list)<3 and frame_count>=randint(min_delay,max_delay)and spawn_chance==1:
      if len(cactus_list)==0 or cactus_list[-1]<350-min_distance:
        var_asset=randint(2,3);var_assetc=randint(1,6)
        if var_assetc==6:
          decal=0
          for g in range(var_asset):decal+=20;cactus_list.append(350+int(decal))
        else:cactus_list.append(350);frame_count=0
    if frame_count_sol>=next_sol_delay:sol_y=randint(197,203);sol_list.append([320,sol_y]);frame_count_sol=0;next_sol_delay=randint(1,3)
    min_bird_distance=260+difficulty_level*6;min_delay_bird=max(40,frame_count_bird//2);max_delay_bird=min_delay_bird+40;spawn_chance=randint(1,7)
    if len(bird_list)<1 and len(cactus_list)<100 and frame_count_bird>=randint(min_delay_bird,max_delay_bird)and score>300 and spawn_chance==2:cactus_list.append(650);bird_pos_y=randint(150,180);bird_list.append([400,bird_pos_y]);frame_count_bird=0
    if len(nuage_list)<3 and frame_count_nuage>=next_nuage_delay:nuage_y=randint(50,120);nuage_list.append([320,nuage_y]);frame_count_nuage=0;next_nuage_delay=randint(20-difficulty_level,60-difficulty_level)
    if len(sol_list)<5 and frame_count_sol>=next_sol_delay:sol_y=randint(197,203);sol_list.append([320,sol_y]);frame_count_sol=0;next_sol_delay=randint(1,3)
    if len(roche_list)<2 and frame_count_roche>=next_roche_delay:roche_list.append(500);frame_count_roche=0;next_roche_delay=randint(20-difficulty_level,60-difficulty_level)
    clear_player(x,y);clear_draw_playerp_ac(x,y);y+=y_velocity
    if y<ground:y_velocity+=gravity
    else:y=ground;y_velocity=0
    if keydown(KEY_DOWN):
      gravity+=7;frame=anim_frame%15
      if frame%5<2:draw_playerpg1_ac(x,y)
      else:draw_playerpd2_ac(x,y)
    else:gravity=2
    if y<ground and not keydown(KEY_DOWN):draw_player(x,y)
    elif not keydown(KEY_DOWN):
      frame=anim_frame%15
      if frame%5<2:draw_playerpg2(x,y)
      else:draw_playerpd3(x,y)
    for o in range(len(nuage_list)):clear_nuage(nuage_list[o][0],nuage_list[o][1]);nuage_list[o][0]-=nuage_speed;draw_nuage(nuage_list[o][0],nuage_list[o][1])
    for u in range(len(sol_list)):clear_sol(sol_list[u][0],sol_list[u][1]);sol_list[u][0]-=sol_speed;draw_sol(sol_list[u][0],sol_list[u][1])
    for r in range(len(roche_list)):clear_roche(roche_list[r],ground);roche_list[r]-=roche_speed;draw_roche(roche_list[r],ground)
    for i in range(len(cactus_list)):
      clear_cactus(cactus_list[i],ground);cactus_list[i]-=cactus_speed;draw_cactus(cactus_list[i],ground);cactus_x=cactus_list[i];cactus_y=ground
      if not keydown(KEY_DOWN):
        if check_collision(x,y,cactus_x,cactus_y):
          reset()
          while not keydown(KEY_OK):sleep(.1)
          break
      elif check_collision_ac(x,y,cactus_x,cactus_y):
        reset()
        while not keydown(KEY_OK):sleep(.1)
        break
    for f in range(len(bird_list)):
      bx,by=bird_list[f];clear_bird(bx,by);bird_list[f][0]-=bird_speed;bx=bird_list[f][0];frame=anim_frame%10
      if frame%5<2:draw_bird(bx,by)
      else:draw_birdp2(bx,by)
      if check_collision_bird(x,y,bx,by):
        reset()
        while not keydown(KEY_OK):sleep(.1)
        break
    cactus_list=[c for c in cactus_list if c>-10];nuage_list=[n for n in nuage_list if n[0]>-50];sol_list=[s for s in sol_list if s[0]>-10];roche_list=[r for r in roche_list if r>-20];bird_list=[z for z in bird_list if z[0]>-30];frame_count+=randint(1,4+difficulty_level//3);frame_count_nuage+=1;frame_count_sol+=1;frame_count_roche+=1;frame_count_bird+=1;elapsed_frames+=1;anim_frame+=1
    if elapsed_frames%60==0:difficulty_level+=1;cactus_speed=min(14,10+difficulty_level//3);bird_speed=min(14,10+difficulty_level//3);roche_speed=min(14,10+difficulty_level//3);sol_speed=min(14,10+difficulty_level//3);nuage_speed=min(14,5+difficulty_level//3)
    sleep(.03)
    if keydown(KEY_OK)and y==ground and not keydown(KEY_DOWN):y_velocity=jump_force
    if keydown(KEY_BACKSPACE)and pause==0:
      tmp=elapsed_frames;pause=1;draw_string('pause',133,110,color1,colorc);sleep(.5)
      while not keydown(KEY_BACKSPACE)and pause==1:sleep(.1)
      fill_rect(0,0,320,222,colorc)
    if tmp+20<elapsed_frames:pause=0

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.