lou.py

Created by antarctus

Created on October 12, 2021

3.73 KB

Like One Uquilosorus (lou) est un jeu où tu incarnes un espadon antique et où ton but est de faire exploser les bulles environnantes.


Vous pouvez me contacter sur Discord à l’aide de ce lien https://discord.gg/wNtEFdQgWD.
N’hésitez pas à venir, vous pourriez découvrir des choses intéressantes…


#arrrrrgggg!!!!!!

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


bulles=[[260,20],[320,50],[380,100],[440,70],[500,40]]
anims=[]
#background=[["",320,1],["",320,3],["",320,2]]

score=0
pos=0
dead=0
avance=300
best_score=0

def draw_name():
  draw_string("Like",avance-200,60,(0,255,255),(0,0,200))
  draw_string("One",avance-200,80,(0,255,255),(0,0,200))
  draw_string("Uquilosorius",avance-200,100,(0,255,255),(0,0,200))

def draw_uquilosorus(y):
  fill_rect(0,y-10,20,30,(0,150,210))
  fill_rect(10,y,30,10,(0,120,255))
  fill_rect(7,y-7,5,5,(0,255,0))

def draw_all_uquilosorus(x,y):
  fill_rect(x-30,y-10,50,30,(0,150,210))
  fill_rect(x+10,y,30,10,(0,120,255))
  fill_rect(x+7,y-7,5,5,(0,255,0))
  fill_rect(x-40,y-20,15,50,(0,120,255))
  fill_rect(x-55,y-23,22,10,(0,120,255))
  fill_rect(x-55,y+23,22,10,(0,120,255))


def draw_bulle(x,y):
  fill_rect(x,y,28,28,(0,200,255))
  fill_rect(x+4,y+4,20,20,(0,100,230))

def destroy_bulle(x,y):
  global score
  score+=1
  anims.append([x,pos-11,0])

def draw_anims():
  global anims
  for i in range(len(anims)-1,-1,-1):
    anims[i][2]+=1
    if anims[i][2]>=20:
      del anims[i]
      continue

    x,y,steps=anims[i][0],anims[i][1],anims[i][2]

    fill_rect(x+11,y-6,6,20-steps,(0,200,255))
    fill_rect(x+11,y+14+steps,6,20-steps,(0,200,255))

    fill_rect(x-6,y+11,20-steps,6,(0,200,255))
    fill_rect(x+14+steps,y+11,20-steps,6,(0,200,255))


def reset():
  global bulles,anims,score,pos,dead,avance
  bulles=[[260,20],[320,50],[380,110],[440,70],[500,40]]
  anims=[]
  #background=[["",320,1],["",320,3],["",320,2]]

  score=0
  pos=0
  dead=0
  avance=300

def play():
  global pos,avance,bulles,anims,score,dead
  while True:
    fill_rect(0,0,320,222,(0,0,200))

#    for i in background:
#    i[1]-=i[2]
#    fill_rect(i[1],50,10,10,(255,255,0))

    if avance>-300:
      draw_name()
      avance-=2

    for i in range(len(bulles)):
      bulles[i][0]-=4
      draw_bulle(bulles[i][0],bulles[i][1])

    pos+=(keydown(2)-keydown(1))*5
    if not(0<=pos<=213):
      pos=213*(pos>213)

    draw_anims()
    draw_uquilosorus(pos)
    draw_string(str(score),280,10,(0,255,255),(0,0,200))

    if dead:
      break

    if len(bulles)<6:
      bulles.append([bulles[-1][0]+60,bulles[-1][1]+randint(30,50)*(randint(0,1)*2-1)])
      if bulles[-1][1]>194:
        bulles[-1][1]=194
      elif bulles[-1][1]<0:
        bulles[-1][1]=0

    if bulles[0][0]<40:
      if bulles[0][1]<pos+1<bulles[0][1]+40:
        destroy_bulle(bulles[0][0],bulles[0][1])
        del bulles[0]
      elif bulles[0][0]<0:
        dead=1

    sleep(0.03)

def anim_end():
  print(score)
  bulles=[]

  for i in range(130):
    fill_rect(0,0,320,222,(0,0,200))

    if (i*4)>200:
      draw_string("GAME OVER",80,pos-10,(0,255,255),(0,0,200))
      draw_string("score :"+str(score),80,pos+10,(0,255,255),(0,0,200))

    elif (i*4)>170:
      draw_string("GAME OV",80,pos-10,(0,255,255),(0,0,200))
      draw_string("score: ",80,pos+10,(0,255,255),(0,0,200))

    elif (i*4)>140:
      draw_string("GAM",80,pos-10,(0,255,255),(0,0,200))
      draw_string("scor",80,pos+10,(0,255,255),(0,0,200))

    for j in range(len(bulles)):
      bulles[j][1]-=1
      draw_bulle(bulles[j][0],bulles[j][1])

    if randint(0,int(i**0.5))==0:
      bulles.append([i*3-20,pos+(randint(0,1)*2-1)*5])

    draw_all_uquilosorus(i*3,pos)
    sleep(0.025)

  draw_string("Replay: OK",190,pos-10,(0,255,255),(0,0,200))
  draw_string("Quit: EXE",190,pos+10,(0,255,255),(0,0,200))
  draw_string("Best score: "+str(best_score),80,pos+30,(0,255,255),(0,0,200))


while True:
  if keydown(KEY_OK) or not dead:
    reset()
    play()
    sleep(1)
    if score>best_score:
      best_score=score
    anim_end()

  elif keydown(KEY_EXE):
    break


#488

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.