pok_a.py

Created by pikube

Created on December 12, 2019

4.19 KB

ATTENTION: Ce programme exige toute la mémoire de la calculatrice, et est couplé aux autres scripts commençeant par pok_ (f,c,m, et s). Il requiert OMEGA 1.16.0-0 (allez voir https://github.com/Omega-Numworks/Omega).

Ce script contient toutes les attaques que peut effectuer un pokémon, l’écran de fin et construit les menus et les pokémons.


from pok_m import *
from pok_f import *
from kandinsky import *
from random import *
import time

def charge(x,y,size,col,draw,vx):
  draw(x,y,[255,255,255],size)
  time.sleep(0.2)
  draw(x+vx,y,col,size)
  time.sleep(0.2)
  draw(x+vx,y,[0,0,0],size)
  draw(x,y,col,size)

def degats(x,y,size,col,draw,vx):
  draw(x,y,[0,0,0],size)
  for loop in range(6):
    mx,my=x+choice([-2,2])*size,y-choice([-1,1])*size
    draw(mx,my,[255,0,0],size)
    time.sleep(0.03)
    draw(mx,my,[0,0,0],size)
  draw(x,y,col,size)
  time.sleep(0.3)

def rage(x1,y1,size,col,draw,vx):
  x=x1+size*2
  y=y1-size
  for loop in range(40):
    fill(x-randint(-15,15),y-randint(1,6),size*randint(10,15),randint(1,size),(80,80,80))
    time.sleep(0.01)
  time.sleep(0.5)

def flow(x1,y1,size,col,draw,vx):
  if vx>0:
    x=x1+20*size
  else:
    x=x1
  y=y1+size*8
  for loop in range(20):
    fill(loop*vx+x,randint(y-20,y+20),10,10,col)
    time.sleep(0.02)

def lazer(x1,y1,size,col,draw,vx):
  y=y1+size*8
  if vx>0:
    x=x1+20*size
  else:
    x=x1-size*5+1
  fill(x-vx+3,y-5,10,20,col)
  fill(x+vx+1,y-3,14,16,col)
  for loop in range(25):
    fill(x+loop*vx,y,10,10,col)
    fill(x+loop*vx,y+2,10,6,(255,255,255))
    time.sleep(0.02)
def txt(string):
  draw_string(string,160-5*len(string),114,[255,255,255],[0,0,0])
  #redessine le menu rogne par le texte
  fill_rect(0,114+16,320,1,(255,255,255))  
def b_arrow(x):
  for loop in range(15):
    fill_rect(x+loop-5,113-loop,30-2*loop,1,(255,255,255))
def grass():
  for loop in range(150):
    fill_rect(randint(0,320),randint(0,110),4,4,(200,200,200))

def draw_pokedex():
  x=34
  y=2
  #dark parts
  fill_rect(x+27,y+127,9*23,9,(0,0,0))
  fill_rect(x+9,y+135,26*9,9,(0,0,0))
  fill_rect(x,144+y,28*9,5*9,(0,0,0))
  fill_rect(x+9,y+144+5*9,26*9,9,(0,0,0))
  fill_rect(x+18,y+144+6*9,24*9,9,(0,0,0))
  fill_rect(x+15*9,y+144+7*9,10*9,9,(0,0,0))
  fill_rect(x+36,y+127-3*9,20*9,12*9,(0,0,0))
  fill_rect(x+27,y,21*9,12*9,(0,0,0))
  #red parts
  fill_rect(x+36,y+9,19*9,10*9,(255,0,0))
  fill_rect(x+45,y+136-3*9,16*9,9*9,(255,0,0))
  fill_rect(x+45,y+136-3*9+9*9,10*9,9,(255,0,0))
  #screen borders
  fill_rect(x+54,y+18,11*9,8*9,(0,0,0))
  fill_rect(x+54,y+136-2*9,14*9,7*9,(0,0,0))
  #screen borders and micro
  fill_rect(x+63,y+27,9*9,6*9,(255,255,255))
  fill_rect(x+63,y+136-1*9,12*9,5*9,(255,255,255))
  fill_rect(x+63+12*9,y+36,9,9,(0,0,0))
  fill_rect(x+72+12*9,y+45,9,9,(0,0,0))
  fill_rect(x+63+12*9,y+54,9,9,(0,0,0))
  fill_rect(x+72+12*9,y+45,9,9,(0,0,0))
  fill_rect(x+72+12*9,y+63,9,9,(0,0,0))
  fill_rect(x+81+12*9,y+54,9,9,(0,0,0))
  fill_rect(x+81+12*9,y+36,9,9,(0,0,0))
  #hell grey parts
  fill_rect(x+9,y+9*17,9,4*9,(48,48,48))
  fill_rect(x+18,y+9*16,18,54,(48,48,48))
  #dunkel grey parts
  fill_rect(x+22*9,y+15*9,4*9,7*9,(64,64,64))
  fill_rect(x+26*9,y+17*9,9,4*9,(64,64,64))
  fill_rect(x+16*9,y+22*9,8*9,9,(64,64,64))
  #joysyick finally :)
  fill_rect(x+23*9,y+18*9,19,18,(0,255,0))
#create all pokemons
tylton1=pokemon(tylton,[30,35,[200,200,255],3,50],60,[degats,charge,flow,rage],1.5)
tylton2=pokemon(tylton,[230,35,[200,200,255],3,-50],60,[degats,charge,flow,rage],1.5)
flameu1=pokemon(flameu,[30,35,[255,0,0],3,50],50,[degats,charge,lazer,rage],1.2)
flameu2=pokemon(flameu,[230,35,[255,0,0],3,-50],50,[degats,charge,lazer,rage],1.2)
pikachu1=pokemon(pika,[30,35,[255,225,0],3,50],90,[degats,charge,lazer,rage],1)
pikachu2=pokemon(pika,[230,35,[255,225,0],3,-50],90,[degats,charge,lazer,rage],1)
mymig1=pokemon(mymig,[30,35,[140,228,106],3,50],120,[degats,charge,flow,rage],0.5)
mymig2=pokemon(mymig,[230,35,[140,228,106],3,-50],120,[degats,charge,flow,rage],0.5)
#refresh after invoke
fill_rect(0,0,320,222,(255,255,255))
#create all menus
attaques1=menu(["rage","special","charge"],["rage","special","charge"])
attaques2=menu(["rage","special","charge"],["rage","special","charge"])
potions1=menu(["soin","force"],["soin","force"])
potions2=menu(["soin","force"],["soin","force"])
pokemon1=menu(["flameu","pikachu","tylton","mymigal"],[flameu1,pikachu1,tylton1,mymig1])
pokemon2=menu(["flameu","pikachu","tylton","mymigal"],[flameu2,pikachu2,tylton2,mymig2])
menus1=menu(["attaques","potions","pokemon"],[attaques1,potions1,pokemon1])
menus2=menu(["attaques","potions","pokemon"],[attaques2,potions2,pokemon2])

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.