rapple.py

Created by charles13-giraud

Created on January 04, 2025

4.26 KB

rapple est un rage game ou le but est de récupérer le plus de pomme (carré vert ) sans toucher les extrémité de l’écran et sans s’arrêter si on ne veut pas voir son bougy decendre (quand il arrive a 0 la partie se finit)

ps: si vous aimez mincraft et la programmation (ou si vous avez juste des idée de mode) vous pouvez rejoindre mon serveur discorde à cette adresse https://discord.gg/2CqjmCVM pour venir programmer des mods ou des plagiat de mincraft ou encore simplement des jeux en rapport avec mincraft


from kandinsky import *
from random import *
from time import *
from ion import *

x=150
y=100
bcl=0
scr=0
c=randint(3,307)
d=randint(3,169)
pb=0
e=0
o=0
a=0
j=0
t=0.01
p=0
r=2
v=0
ts=5
sk1=color(255,255,255)
sk2=color(0,0,255)
sk3=color(200,20,250)
sk=2

sleep(0.2)

fill_rect(0,0,400,400,(0,0,1))

#eccran d acceuille

while p==0 :

  draw_string("RAPPLE",130,50,(255,0,0),(0,0,1))
  draw_string("play",140,100,(255,0,0),(0,0,1))
  draw_string("skin",140,120,(255,0,0),(0,0,1))
  if v==0 :
    draw_string("<play>",130,100,(255,0,0),(0,0,1))
  if v==1 :
    draw_string("<skin>",130,120,(255,0,0),(0,0,1))
  if keydown(KEY_DOWN) :
    v=1
    fill_rect(130,100,60,15,(0,0,1))
  if keydown(KEY_UP) :
    v=0
    fill_rect(120,120,80,15,(0,0,1))

#lance la partie ou l ecran des skines

  if keydown(KEY_OK) :
    if v==0 :
      p=1
    if v==1 :
      fill_rect(0,0,400,400,(0,0,1))
      
#ecran des skines    
      
      while e==0 :
        draw_string("blanc",45,100,(255,0,0),(0,0,1))
        draw_string("bleu",135,100,(255,0,0),(0,0,1))
        draw_string("violet",215,100,(255,0,0),(0,0,1))
        if r==2:
          draw_string("<bleu>",125,100,(255,0,0),(0,0,1))
        if r==3:
          draw_string("<violet>",205,100,(255,0,0),(0,0,1))
        if r==1:
          draw_string("<blanc>",35,100,(255,0,0),(0,0,1))
        sleep(0.2)  
        if keydown(KEY_LEFT) :
          if r == 2 :
            r=1
            fill_rect(125,100,60,15,(0,0,1))
          if r == 3 :
            r=2
            fill_rect(205,100,80,15,(0,0,1))
        if keydown(KEY_RIGHT) :
          if r == 2 :
            r=3
            fill_rect(125,100,60,15,(0,0,1))
          if r == 1 :
            r=2
            fill_rect(35,100,70,15,(0,0,1))
        if keydown(KEY_OK) :
          fill_rect(0,0,400,400,(0,0,1))
          e=1
          if r==1 :
            sk=1
          if r==2 :
            sk=2
          if r==3 :
            sk=3

#affiche les fonds
             
fill_rect(0,0,400,162+20,(0,0,1))
fill_rect(0,182,400,400,(90,0,0))

while bcl==0 :
  
#affiche les elements
    
  fill_rect(c,d,10,10,(0,255,0)) 
  if sk==1:
    fill_rect(x,y,20,20,sk1)
  elif sk==2:
    fill_rect(x,y,20,20,sk2)
  else :
    fill_rect(x,y,20,20,sk3)
  draw_string("score :",10,192,(255,0,0),(90,0,0))
  draw_string(str(scr),90,193,(255,0,0),(90,0,0))
  draw_string("bougy :",130,192,(255,0,0),(90,0,0))
  draw_string(str(o),210,193,(255,0,0),(90,0,0))
  if o==100 :
      fill_rect(230,193,10,15,(90,0,0))
  
#mouvement 
  
  if keydown(KEY_DOWN) and y<162:
    fill_rect(x,y,20,1,(0,0,1))
    y=y+1
    pb=1
    a=1 
  if keydown(KEY_UP) and y>0:
    fill_rect(x,y+19,20,1,(0,0,1))
    y=y-1
    pb=1
    a=1
  if keydown(KEY_LEFT) and x>0:
    fill_rect(x+19,y,1,20,(0,0,1))
    x=x-1
    pb=1
    a=1
  if keydown(KEY_RIGHT) and x<300:
    fill_rect(x,y,1,20,(0,0,1))
    x=x+1
    pb=1
    a=1
    
#detecte si le perso ne bouge pas
  
  if a!=1 :
    if pb==1 :
      o=o-1
  a=0
      
#detecte les collision avec la pomme
  
  if x<c<x+20 and y<d<y+20 :
    fill_rect(c,d,10,10,(0,0,1))
    c=randint(0,310)
    d=randint(0,172)
    scr=scr+1
  if x<c<x+20 and y<d+10<y+20 :
    fill_rect(c,d,10,10,(0,0,1))
    c=randint(0,310)
    d=randint(0,172)
    scr=scr+1
  if x<c+10<x+20 and y<d<y+10 :
    fill_rect(c,d,10,10,(0,0,1))
    c=randint(0,310)
    d=randint(0,172)
    scr=scr+1
  if x<c+10<x+20 and y<d+10<y+10 :
    fill_rect(c,d,10,10,(0,0,1))
    c=randint(0,310)
    d=randint(0,172)
    scr=scr+1
    
#collision avec les mures
  
  if y==0 :
    j=1
  if y==162 :
    j=1
  if x==300 :
    j=1
  if x==0 :
    j=1

#dit qu on meurt quand on a 200 bougy

  if o==0 :
    j=1
  
#ecran de mort
  
  if j==1 :
    fill_rect(0,0,400,400,(0,0,1))
    draw_string("GAME OVER",110,60,(255,0,0),(0,0,1))
    draw_string("score :",110,95,(255,0,0),(1,0,0))
    draw_string(str(scr),190,95,(255,0,0),(1,0,0))
    while j==1 :
      if keydown(KEY_OK) :
         fill_rect(0,0,400,400,(0,0,1))
         fill_rect(0,182,400,400,(90,0,0))
         t=0.01
         ts=5
         j=0
         x=150
         y=100
         bcl=0
         scr=0
         c=randint(3,307)
         d=randint(3,169)
         pb=0
         o=200
         a=0
          
#augmente la vitesse !!!          
          
  if ts == scr :
    t=t*0.9
    ts=scr+5
  sleep(t)

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.