grown_up.py

Created by marius-layan

Created on February 05, 2024

2.07 KB

Grown_up est un jeu avec comme but être le plus gros possible en mangeant des pastilles vert (un peux comme agar.io) et avec comme petit bonus des missiles qui vienne du haut de l’écran et sont avertis avec un laser qui traverse l’écran. Le but pour moi a était de créer une nouvelle manière de se déplacer dans l’espace 2d.

pour boucher: flèches directionnelles gauche et droite

BON JEU !


from kandinsky import *
from ion import *
from time import *
from random import *
x,y,k,a,b,f,h,j,l,o,m,p=155,106,[20,0],8,[[randint(0,315),randint(0,217)] for i in range(5)],(0,0,0),(0,255,0),5,1,(255,255,255),[[randint(2,308),-50]],0
while True:
  fill_rect(0,0,320,222,f)
  if keydown(KEY_LEFT) and k[0]>=0 and k[1]<=0:k[0]-=1;k[1]-=1
  if keydown(KEY_LEFT) and k[0]<=0 and k[1]<=0:k[0]-=1;k[1]+=1
  if keydown(KEY_LEFT) and k[0]<=0 and k[1]>=0:k[0]+=1;k[1]+=1
  if keydown(KEY_LEFT) and k[0]>=0 and k[1]>=0:k[0]+=1;k[1]-=1
  if keydown(KEY_RIGHT) and k[0]>=0 and k[1]<=0:k[0]+=1;k[1]+=1
  if keydown(KEY_RIGHT) and k[0]<=0 and k[1]<=0:k[0]+=1;k[1]-=1
  if keydown(KEY_RIGHT) and k[0]<=0 and k[1]>=0:k[0]-=1;k[1]-=1
  if keydown(KEY_RIGHT) and k[0]>=0 and k[1]>=0:k[0]-=1;k[1]+=1
  x+=k[0]/10
  y+=k[1]/10
  fill_rect(int(x),int(y),a,a,'gray')
  if randint(0,30)==1:b.append([randint(0,320-j),randint(0,222-j)])
  d=0
  while d==0:
    d=1
    for i in range(len(b)):
      fill_rect(b[i][0],b[i][1],j,j,h)
      if (x<b[i][0]<x+a and y<b[i][1]<y+a) or (x<b[i][0]+j<x+a and y<b[i][1]<y+10) or (x<b[i][0]<x+a and y<b[i][1]+j<y+a) or (x<b[i][0]+j<x+a and y<b[i][1]+j<y+a):fill_rect(b[i][0],b[i][1],j,j,(0,0,0));del b[i];d=0;a+=1;break
  if randint(0,30)==5:
    m.append([randint(2,308),-50])
  n=0
  while n==0:
    n=1
    for i in range(len(m)):
      if m[i][0]<320:
        if m[i][1]<0:fill_rect(m[i][0]+2,0,1,222,(100,0,0));m[i][1]+=1
        else:
          m[i][1]+=10;fill_rect(m[i][0],int(m[i][1]),5,20,o)
          if (x<m[i][0]<x+a and y<int(m[i][1])<y+a) or (x<m[i][0]+5<x+a and y<int(m[i][1])<y+a) or (x<m[i][0]<x+a and y<int(m[i][1]+20)<y+a) or (x<m[i][0]+5<x+a and y<int(m[i][1]+20)<y+a):p=1;break
      else:del m[i];n=0;break
    
  if a==20:j=6
  elif a==30:j=7
  elif a==40:j=8
  elif a==50:j=9
  elif a==50:j=10
  if 0<x<320-a and 0<y<222-a:h,o,f=(0,255,0),(255,255,255),(0,0,0)
  else:f,h,o=(255,255,255),(255,0,255),(0,0,0)
  sleep(0.02)
  if p==1:break
  if -a<x<320 and -a<y<222:continue
  else:break
fill_rect(0,0,320,222,'red');draw_string("score: "+str(a),120,102,'white','red')

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.